* NOTE: For updating this class to the latest hibernate version, update the serialVersionUID as
* described above, copy the new class to the old class BUT keep those 5 places marked with
* ##REMOTING-KEEP##
- *
+ *
* @author Gavin King
* @author Cherian Mathew
*/
isJTA = session.getTransactionCoordinator().getTransactionCoordinatorBuilder().isJta();
-
+
if ( !isJTA ) {
// Explicitly handle the transactions only if we're not in
// a JTA environment. A lazy loading temporary session can
// both when using property paths and switching off conversations
if(session == null && remoting) {
remoteInitialize();
- } else {
+ } else {
//keep formatting below to ease update to newer hibernate version
//##REMOTING-KEEP END##
withTemporarySessionIfNeeded(
this.orphan = orphan;
}
- public void replace(CollectionPersister persister, Map copyCache) {
+ @Override
+ public void replace(CollectionPersister persister, Map copyCache) {
if ( addedValue != null ) {
addedValue = getReplacement( persister.getElementType(), addedValue, copyCache );
}
this.owner = owner;
}
-
-/** ##REMOTING-KEEP## #######################################################
-
+
+/** ##REMOTING-KEEP## #######################################################
+
ADDED PART: Below is the section of code which makes remote service calls.
Keeps this code when upgrading to newer hibernate version. Also keep
other code marked with ##REMOTING-KEEP## in the following 5 methods:
-
+
{@link #initialize(boolean)}
{@link #readSize()}
{@link #readIndexExistence(Object)}
{@link #readElementExistence(Object)}
{@link #readElementByIndex(Object)}
-
+
######################################################################### */
-
+
private static CdmApplicationRemoteConfiguration configuration;
private static boolean remoting = false;
private void remoteInitialize() {
if (getOwner() != null && !initialized) {
-
+ Object collectionType = null;
+ Field field = null;
try {
String role = getRole();
String fieldName = role.substring(role.lastIndexOf(".") + 1);
if (clazz != null) {
//CollectionField cf = cachedCommonService.getCollectionField(col);
//cachedCommonService.updatePersistentCollection(cf);
- Object collectionType = ProxyUtils.getCollectionType(obj, clazz);
- Field field = clazz.getDeclaredField(collectionType.toString());
+ collectionType = ProxyUtils.getCollectionType(obj, clazz);
+ field = clazz.getDeclaredField(collectionType.toString());
field.setAccessible(true);
field.set(this, obj);
ProxyUtils.setRoleValueInOwner(owner, role, obj);
}
} catch (Exception ex) {
- throw new CdmEagerLoadingException(ex);
+ String originalMessage = ex.getMessage();
+
+ String message = originalMessage + " - field: " + field + " - collectionType: " + collectionType.toString();
+ throw new CdmEagerLoadingException(message);
}
}
}