Project

General

Profile

« Previous | Next » 

Revision 0c247ba9

Added by Katja Luther over 3 years ago

add additional debugging in AbstractPersistentCollection

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java
63 63
 * NOTE: For updating this class to the latest hibernate version, update the serialVersionUID as
64 64
 *       described above, copy the new class to the old class BUT keep those 5 places marked with
65 65
 *       ##REMOTING-KEEP##
66
 * 
66
 *
67 67
 * @author Gavin King
68 68
 * @author Cherian Mathew
69 69
 */
......
274 274

  
275 275

  
276 276
			isJTA = session.getTransactionCoordinator().getTransactionCoordinatorBuilder().isJta();
277
			
277

  
278 278
			if ( !isJTA ) {
279 279
				// Explicitly handle the transactions only if we're not in
280 280
				// a JTA environment.  A lazy loading temporary session can
......
638 638
	    // both when using property paths and switching off conversations
639 639
	    if(session == null && remoting) {
640 640
	        remoteInitialize();
641
	    } else { 
641
	    } else {
642 642
	    //keep formatting below to ease update to newer hibernate version
643 643
		//##REMOTING-KEEP END##
644 644
	    withTemporarySessionIfNeeded(
......
1236 1236
			this.orphan = orphan;
1237 1237
		}
1238 1238

  
1239
		public void replace(CollectionPersister persister, Map copyCache) {
1239
		@Override
1240
        public void replace(CollectionPersister persister, Map copyCache) {
1240 1241
			if ( addedValue != null ) {
1241 1242
				addedValue = getReplacement( persister.getElementType(), addedValue, copyCache );
1242 1243
			}
......
1374 1375
		this.owner = owner;
1375 1376
	}
1376 1377

  
1377
	
1378
/** ##REMOTING-KEEP## ####################################################### 
1379
    
1378

  
1379
/** ##REMOTING-KEEP## #######################################################
1380

  
1380 1381
    ADDED PART: Below is the section of code which makes remote service calls.
1381 1382
    Keeps this code when upgrading to newer hibernate version. Also keep
1382 1383
    other code marked with ##REMOTING-KEEP## in the following 5 methods:
1383
    
1384

  
1384 1385
    {@link #initialize(boolean)}
1385 1386
	{@link #readSize()}
1386 1387
	{@link #readIndexExistence(Object)}
1387 1388
	{@link #readElementExistence(Object)}
1388 1389
	{@link #readElementByIndex(Object)}
1389
    
1390

  
1390 1391
    ######################################################################### */
1391
    
1392

  
1392 1393
	private static CdmApplicationRemoteConfiguration configuration;
1393 1394
	private static boolean remoting = false;
1394 1395

  
......
1400 1401
	private void remoteInitialize() {
1401 1402

  
1402 1403
		if (getOwner() != null && !initialized) {
1403

  
1404
		    Object collectionType = null;
1405
		    Field field = null;
1404 1406
			try {
1405 1407
				String role = getRole();
1406 1408
				String fieldName = role.substring(role.lastIndexOf(".") + 1);
......
1431 1433
				if (clazz != null) {
1432 1434
					//CollectionField cf = cachedCommonService.getCollectionField(col);
1433 1435
					//cachedCommonService.updatePersistentCollection(cf);
1434
				    Object collectionType = ProxyUtils.getCollectionType(obj, clazz);
1435
					Field field = clazz.getDeclaredField(collectionType.toString());
1436
				    collectionType = ProxyUtils.getCollectionType(obj, clazz);
1437
				    field = clazz.getDeclaredField(collectionType.toString());
1436 1438
					field.setAccessible(true);
1437 1439
					field.set(this, obj);
1438 1440
					ProxyUtils.setRoleValueInOwner(owner, role, obj);
1439 1441

  
1440 1442
				}
1441 1443
			} catch (Exception ex) {
1442
				throw new CdmEagerLoadingException(ex);
1444
			    String originalMessage = ex.getMessage();
1445

  
1446
			    String message = originalMessage + " - field: " + field + " - collectionType: " + collectionType.toString();
1447
			    throw new CdmEagerLoadingException(message);
1443 1448
			}
1444 1449
		}
1445 1450
	}

Also available in: Unified diff