simple code refact
This commit is contained in:
parent
dc7feab061
commit
71adfabca8
|
@ -50,7 +50,7 @@ public class VersionValue implements UnsavedValueStrategy {
|
||||||
@Override
|
@Override
|
||||||
public final Boolean isUnsaved(Object version) {
|
public final Boolean isUnsaved(Object version) {
|
||||||
LOG.trace("Version unsaved-value strategy NULL");
|
LOG.trace("Version unsaved-value strategy NULL");
|
||||||
return version==null ? Boolean.TRUE : Boolean.FALSE;
|
return version==null;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Object getDefaultValue(Object currentValue) {
|
public Object getDefaultValue(Object currentValue) {
|
||||||
|
@ -69,7 +69,7 @@ public class VersionValue implements UnsavedValueStrategy {
|
||||||
@Override
|
@Override
|
||||||
public final Boolean isUnsaved(Object version) {
|
public final Boolean isUnsaved(Object version) {
|
||||||
LOG.trace("Version unsaved-value strategy UNDEFINED");
|
LOG.trace("Version unsaved-value strategy UNDEFINED");
|
||||||
return version==null ? Boolean.TRUE : null;
|
return version==null;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Object getDefaultValue(Object currentValue) {
|
public Object getDefaultValue(Object currentValue) {
|
||||||
|
@ -90,7 +90,7 @@ public class VersionValue implements UnsavedValueStrategy {
|
||||||
public final Boolean isUnsaved(Object version) throws MappingException {
|
public final Boolean isUnsaved(Object version) throws MappingException {
|
||||||
LOG.trace("Version unsaved-value strategy NEGATIVE");
|
LOG.trace("Version unsaved-value strategy NEGATIVE");
|
||||||
if (version==null) return Boolean.TRUE;
|
if (version==null) return Boolean.TRUE;
|
||||||
if (version instanceof Number) return ((Number)version).longValue() < 0l ? Boolean.TRUE : Boolean.FALSE;
|
if (version instanceof Number) return ((Number)version).longValue() < 0l;
|
||||||
throw new MappingException("unsaved-value NEGATIVE may only be used with short, int and long types");
|
throw new MappingException("unsaved-value NEGATIVE may only be used with short, int and long types");
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
@ -121,7 +121,7 @@ public class VersionValue implements UnsavedValueStrategy {
|
||||||
@Override
|
@Override
|
||||||
public Boolean isUnsaved(Object version) throws MappingException {
|
public Boolean isUnsaved(Object version) throws MappingException {
|
||||||
LOG.trace("Version unsaved-value: " + value);
|
LOG.trace("Version unsaved-value: " + value);
|
||||||
return version==null || version.equals(value) ? Boolean.TRUE : Boolean.FALSE;
|
return version==null || version.equals(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -84,7 +84,7 @@ public final class IdentifierGeneratorHelper {
|
||||||
if ( !rs.next() ) {
|
if ( !rs.next() ) {
|
||||||
throw new HibernateException( "The database returned no natively generated identity value" );
|
throw new HibernateException( "The database returned no natively generated identity value" );
|
||||||
}
|
}
|
||||||
final Serializable id = IdentifierGeneratorHelper.get( rs, type );
|
final Serializable id = get( rs, type );
|
||||||
LOG.debugf("Natively generated identity: %s", id);
|
LOG.debugf("Natively generated identity: %s", id);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,14 +42,14 @@ public interface LazyInitializer {
|
||||||
public void initialize() throws HibernateException;
|
public void initialize() throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the identifier value for the enity our owning proxy represents.
|
* Retrieve the identifier value for the entity our owning proxy represents.
|
||||||
*
|
*
|
||||||
* @return The identifier value.
|
* @return The identifier value.
|
||||||
*/
|
*/
|
||||||
public Serializable getIdentifier();
|
public Serializable getIdentifier();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the identifier value for the enity our owning proxy represents.
|
* Set the identifier value for the entity our owning proxy represents.
|
||||||
*
|
*
|
||||||
* @param id The identifier value.
|
* @param id The identifier value.
|
||||||
*/
|
*/
|
||||||
|
@ -93,7 +93,7 @@ public interface LazyInitializer {
|
||||||
*
|
*
|
||||||
* @throws HibernateException Indicates problem locating the target.
|
* @throws HibernateException Indicates problem locating the target.
|
||||||
*/
|
*/
|
||||||
public abstract Object getImplementation(SessionImplementor session) throws HibernateException;
|
public Object getImplementation(SessionImplementor session) throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the proxy manually by injecting its target.
|
* Initialize the proxy manually by injecting its target.
|
||||||
|
|
|
@ -1,3 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
package org.hibernate.metamodel.source.annotations.entity;
|
package org.hibernate.metamodel.source.annotations.entity;
|
||||||
|
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Embeddable;
|
||||||
|
|
Loading…
Reference in New Issue