fix some deprecation warnings by using getValues() instead of getPropertyValues()
though I don't like the underlying deprecation that made this necessary, and I would prefer to be able to roll back these changes
This commit is contained in:
parent
678adbf682
commit
ea36099571
|
@ -147,7 +147,7 @@ public class EnhancementAsProxyLazinessInterceptor extends AbstractLazyLoadInter
|
|||
List<AttributeMapping> attributeMappings = entityPersister.getAttributeMappings();
|
||||
for ( int index = 0; index < attributeMappings.size(); index++ ) {
|
||||
if ( writtenFieldName.contains( attributeMappings.get( index ).getAttributeName() ) ) {
|
||||
entityPersister.setPropertyValue(
|
||||
entityPersister.setValue(
|
||||
target,
|
||||
index,
|
||||
writtenValues[index]
|
||||
|
|
|
@ -128,7 +128,7 @@ public class CollectionCacheInvalidator
|
|||
// old one
|
||||
oldId = getIdentifier( session, oldState[i] );
|
||||
}
|
||||
Object ref = persister.getPropertyValue( entity, i );
|
||||
Object ref = persister.getValue( entity, i );
|
||||
Object id = getIdentifier( session, ref );
|
||||
|
||||
// only evict if the related entity has changed
|
||||
|
@ -147,9 +147,9 @@ public class CollectionCacheInvalidator
|
|||
}
|
||||
final CollectionDataAccess cacheAccessStrategy = collectionPersister.getCacheAccessStrategy();
|
||||
final SoftLock softLock = cacheAccessStrategy.lockRegion();
|
||||
session.getActionQueue().registerProcess( (success, session1) -> {
|
||||
cacheAccessStrategy.unlockRegion( softLock );
|
||||
} );
|
||||
session.getActionQueue().registerProcess(
|
||||
(success, session1) -> cacheAccessStrategy.unlockRegion( softLock )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry {
|
|||
|
||||
if ( getPersister().isVersioned() ) {
|
||||
this.version = nextVersion;
|
||||
getPersister().setPropertyValue( entity, getPersister().getVersionProperty(), nextVersion );
|
||||
getPersister().setValue( entity, getPersister().getVersionProperty(), nextVersion );
|
||||
}
|
||||
|
||||
if( entity instanceof SelfDirtinessTracker ) {
|
||||
|
@ -383,7 +383,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry {
|
|||
// TODO: use LockMode.PESSIMISTIC_FORCE_INCREMENT
|
||||
//noinspection deprecation
|
||||
setLockMode( LockMode.FORCE );
|
||||
persister.setPropertyValue( entity, getPersister().getVersionProperty(), nextVersion );
|
||||
persister.setValue( entity, getPersister().getVersionProperty(), nextVersion );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -410,7 +410,7 @@ public abstract class AbstractEntityEntry implements Serializable, EntityEntry {
|
|||
throw new IllegalStateException( "Cannot make an immutable entity modifiable." );
|
||||
}
|
||||
setStatus( Status.MANAGED );
|
||||
loadedState = getPersister().getPropertyValues( entity );
|
||||
loadedState = getPersister().getValues( entity );
|
||||
getPersistenceContext().getNaturalIdResolutions().manageLocalResolution(
|
||||
id, loadedState, persister,
|
||||
CachedNaturalIdValueSource.LOAD
|
||||
|
|
|
@ -147,7 +147,7 @@ public final class Cascade {
|
|||
}
|
||||
}
|
||||
else {
|
||||
child = persister.getPropertyValue( parent, i );
|
||||
child = persister.getValue( parent, i );
|
||||
}
|
||||
cascadeProperty(
|
||||
action,
|
||||
|
@ -180,7 +180,7 @@ public final class Cascade {
|
|||
eventSource,
|
||||
null,
|
||||
parent,
|
||||
persister.getPropertyValue( parent, i ),
|
||||
persister.getValue( parent, i ),
|
||||
type,
|
||||
style,
|
||||
propertyName,
|
||||
|
|
|
@ -368,7 +368,7 @@ public class CascadingActions {
|
|||
Type propertyType,
|
||||
int propertyIndex) {
|
||||
if ( propertyType.isEntityType() ) {
|
||||
Object child = persister.getPropertyValue( parent, propertyIndex );
|
||||
Object child = persister.getValue( parent, propertyIndex );
|
||||
if ( child != null
|
||||
&& !isInManagedState( child, session )
|
||||
&& !(child instanceof HibernateProxy) ) { //a proxy cannot be transient and it breaks ForeignKeys.isTransient
|
||||
|
|
|
@ -57,7 +57,7 @@ public abstract class AbstractReassociateEventListener {
|
|||
persistenceContext.checkUniqueness( key, object );
|
||||
|
||||
//get a snapshot
|
||||
Object[] values = persister.getPropertyValues( object );
|
||||
Object[] values = persister.getValues( object );
|
||||
TypeHelper.deepCopy(
|
||||
values,
|
||||
persister.getPropertyTypes(),
|
||||
|
|
|
@ -109,7 +109,7 @@ public abstract class AbstractVisitor {
|
|||
public void process(Object object, EntityPersister persister)
|
||||
throws HibernateException {
|
||||
processEntityPropertyValues(
|
||||
persister.getPropertyValues( object ),
|
||||
persister.getValues( object ),
|
||||
persister.getPropertyTypes()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -120,8 +120,8 @@ public class DefaultDeleteEventListener implements DeleteEventListener, Callback
|
|||
|
||||
entityEntry = persistenceContext.addEntity(
|
||||
entity,
|
||||
(persister.isMutable() ? Status.MANAGED : Status.READ_ONLY),
|
||||
persister.getPropertyValues( entity ),
|
||||
persister.isMutable() ? Status.MANAGED : Status.READ_ONLY,
|
||||
persister.getValues( entity ),
|
||||
key,
|
||||
version,
|
||||
LockMode.NONE,
|
||||
|
@ -251,7 +251,7 @@ public class DefaultDeleteEventListener implements DeleteEventListener, Callback
|
|||
final Object version = entityEntry.getVersion();
|
||||
|
||||
final Object[] currentState = entityEntry.getLoadedState() == null
|
||||
? persister.getPropertyValues(entity) //i.e. the entity came in from update()
|
||||
? persister.getValues(entity) //i.e. the entity came in from update()
|
||||
: entityEntry.getLoadedState();
|
||||
|
||||
final Object[] deletedState = createDeletedState( persister, currentState, session );
|
||||
|
|
|
@ -166,7 +166,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
|||
checkId( entity, persister, entry.getId(), session );
|
||||
|
||||
// grab its current state
|
||||
Object[] values = persister.getPropertyValues( entity );
|
||||
Object[] values = persister.getValues( entity );
|
||||
|
||||
checkNaturalId( persister, entity, entry, values, loadedState, session );
|
||||
|
||||
|
@ -263,7 +263,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
|||
dirtyProperties,
|
||||
event.hasDirtyCollection(),
|
||||
status == Status.DELETED && !entry.isModifiableEntity() ?
|
||||
persister.getPropertyValues( entity ) :
|
||||
persister.getValues( entity ) :
|
||||
entry.getLoadedState(),
|
||||
entry.getVersion(),
|
||||
nextVersion,
|
||||
|
@ -568,7 +568,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
|||
// - entry.getDeletedState() contains the entity's current property values with
|
||||
// references to transient entities set to null.
|
||||
// - dirtyProperties will only contain properties that refer to transient entities
|
||||
final Object[] currentState = persister.getPropertyValues( event.getEntity() );
|
||||
final Object[] currentState = persister.getValues( event.getEntity() );
|
||||
dirtyProperties = persister.findDirty( entry.getDeletedState(), currentState, entity, session );
|
||||
dirtyCheckPossible = true;
|
||||
}
|
||||
|
|
|
@ -448,8 +448,8 @@ public class DefaultMergeEventListener extends AbstractSaveEventListener impleme
|
|||
final SessionImplementor source,
|
||||
final Map copyCache) {
|
||||
final Object[] copiedValues = TypeHelper.replace(
|
||||
persister.getPropertyValues( entity ),
|
||||
persister.getPropertyValues( target ),
|
||||
persister.getValues( entity ),
|
||||
persister.getValues( target ),
|
||||
persister.getPropertyTypes(),
|
||||
source,
|
||||
target,
|
||||
|
@ -474,8 +474,8 @@ public class DefaultMergeEventListener extends AbstractSaveEventListener impleme
|
|||
// replacement to associations types (value types were already replaced
|
||||
// during the first pass)
|
||||
copiedValues = TypeHelper.replaceAssociations(
|
||||
persister.getPropertyValues( entity ),
|
||||
persister.getPropertyValues( target ),
|
||||
persister.getValues( entity ),
|
||||
persister.getValues( target ),
|
||||
persister.getPropertyTypes(),
|
||||
source,
|
||||
target,
|
||||
|
@ -485,8 +485,8 @@ public class DefaultMergeEventListener extends AbstractSaveEventListener impleme
|
|||
}
|
||||
else {
|
||||
copiedValues = TypeHelper.replace(
|
||||
persister.getPropertyValues( entity ),
|
||||
persister.getPropertyValues( target ),
|
||||
persister.getValues( entity ),
|
||||
persister.getValues( target ),
|
||||
persister.getPropertyTypes(),
|
||||
source,
|
||||
target,
|
||||
|
|
|
@ -151,11 +151,11 @@ public class WrapVisitor extends ProxyVisitor {
|
|||
|
||||
@Override
|
||||
public void process(Object object, EntityPersister persister) throws HibernateException {
|
||||
final Object[] values = persister.getPropertyValues( object );
|
||||
final Object[] values = persister.getValues( object );
|
||||
final Type[] types = persister.getPropertyTypes();
|
||||
processEntityPropertyValues( values, types );
|
||||
if ( isSubstitutionRequired() ) {
|
||||
persister.setPropertyValues( object, values );
|
||||
persister.setValues( object, values );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
|||
checkOpen();
|
||||
EntityPersister persister = getEntityPersister( entityName, entity );
|
||||
Object id = persister.getIdentifierGenerator().generate( this, entity );
|
||||
Object[] state = persister.getPropertyValues( entity );
|
||||
Object[] state = persister.getValues( entity );
|
||||
if ( persister.isVersioned() ) {
|
||||
boolean substitute = Versioning.seedVersion(
|
||||
state,
|
||||
|
@ -92,7 +92,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
|||
this
|
||||
);
|
||||
if ( substitute ) {
|
||||
persister.setPropertyValues( entity, state );
|
||||
persister.setValues( entity, state );
|
||||
}
|
||||
}
|
||||
if ( id == IdentifierGeneratorHelper.POST_INSERT_INDICATOR ) {
|
||||
|
@ -137,13 +137,13 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
|||
checkOpen();
|
||||
EntityPersister persister = getEntityPersister( entityName, entity );
|
||||
Object id = persister.getIdentifier( entity, this );
|
||||
Object[] state = persister.getPropertyValues( entity );
|
||||
Object[] state = persister.getValues( entity );
|
||||
Object oldVersion;
|
||||
if ( persister.isVersioned() ) {
|
||||
oldVersion = persister.getVersion( entity );
|
||||
Object newVersion = Versioning.increment( oldVersion, persister.getVersionJavaType(), this );
|
||||
Versioning.setVersion( state, newVersion, persister );
|
||||
persister.setPropertyValues( entity, state );
|
||||
persister.setValues( entity, state );
|
||||
}
|
||||
else {
|
||||
oldVersion = null;
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.hibernate.type.Type;
|
|||
public final class EntityPrinter {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( EntityPrinter.class );
|
||||
|
||||
private SessionFactoryImplementor factory;
|
||||
private final SessionFactoryImplementor factory;
|
||||
|
||||
/**
|
||||
* Renders an entity to a string.
|
||||
|
@ -60,7 +60,7 @@ public final class EntityPrinter {
|
|||
|
||||
Type[] types = entityPersister.getPropertyTypes();
|
||||
String[] names = entityPersister.getPropertyNames();
|
||||
Object[] values = entityPersister.getPropertyValues( entity );
|
||||
Object[] values = entityPersister.getValues( entity );
|
||||
for ( int i = 0; i < types.length; i++ ) {
|
||||
if ( !names[i].startsWith( "_" ) ) {
|
||||
final String strValue;
|
||||
|
@ -76,7 +76,7 @@ public final class EntityPrinter {
|
|||
result.put( names[i], strValue );
|
||||
}
|
||||
}
|
||||
return entityName + result.toString();
|
||||
return entityName + result;
|
||||
}
|
||||
|
||||
public String toString(Type[] types, Object[] values) throws HibernateException {
|
||||
|
|
Loading…
Reference in New Issue