Author: cbredesen
Date: 2007-09-20 17:59:46 -0400 (Thu, 20 Sep 2007)
New Revision: 14016
Modified:
core/branches/Branch_3_2/src/org/hibernate/event/def/DefaultFlushEntityEventListener.java
Log:
HHH-2816 avoid re-select on READ_ONLY in checkNaturalId
Modified:
core/branches/Branch_3_2/src/org/hibernate/event/def/DefaultFlushEntityEventListener.java
===================================================================
---
core/branches/Branch_3_2/src/org/hibernate/event/def/DefaultFlushEntityEventListener.java 2007-09-20
21:58:27 UTC (rev 14015)
+++
core/branches/Branch_3_2/src/org/hibernate/event/def/DefaultFlushEntityEventListener.java 2007-09-20
21:59:46 UTC (rev 14016)
@@ -68,12 +68,12 @@
private void checkNaturalId(
EntityPersister persister,
- Serializable identifier,
+ EntityEntry entry,
Object[] current,
Object[] loaded,
EntityMode entityMode,
SessionImplementor session) {
- if ( persister.hasNaturalIdentifier() ) {
+ if ( persister.hasNaturalIdentifier() && entry.getStatus() != Status.READ_ONLY
) {
Object[] snapshot = null;
Type[] types = persister.getPropertyTypes();
int[] props = persister.getNaturalIdentifierProperties();
@@ -84,7 +84,7 @@
Object loadedVal;
if ( loaded == null ) {
if ( snapshot == null) {
- snapshot = session.getPersistenceContext().getNaturalIdSnapshot( identifier,
persister );
+ snapshot = session.getPersistenceContext().getNaturalIdSnapshot( entry.getId(),
persister );
}
loadedVal = snapshot[i];
} else {
@@ -166,7 +166,7 @@
// grab its current state
values = persister.getPropertyValues( entity, entityMode );
- checkNaturalId( persister, entry.getId(), values, loadedState, entityMode, session );
+ checkNaturalId( persister, entry, values, loadedState, entityMode, session );
}
return values;
}
Show replies by date