Project

General

Profile

Revision aa3f1652

IDaa3f1652f3c22e18f42d05ec4e9172426031a230
Parent 78716654
Child 220a3f38

Added by Andreas Müller 2 months ago

ref #9204 some more documentation on how to handle AbstractPersistentCollection

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java
60 60
 * allow making remote service calls to spring httpinvoker services (see section at the bottom
61 61
 * of this class).
62 62
 *
63
 * NOTE: For updating this class to the latest hibernate version, update the serialVersionUID as
64
 *       described above, copy the new class to the old class BUT keep those 5 places marked with
65
 *       ##REMOTING-KEEP##
66
 * 
63 67
 * @author Gavin King
64 68
 * @author Cherian Mathew
65 69
 */
......
173 177
				return true;
174 178
			}
175 179
			else {
180
				//##REMOTING-KEEP##
176 181
				// In remoting we are sure that session is null
177 182
				// both when using property paths and switching off conversations
178 183
				if(session == null && remoting) {
179 184
					LOG.info("--> readSize, of " + getRole() + " with key " + getKey());
180 185
					read();
181
				} else {  //keep formatting to ease update to newer hibernate version
186
				} else {
187
			    //keep formatting below to ease update to newer hibernate version
188
				//##REMOTING-KEEP END##
182 189
				final boolean isExtraLazy = withTemporarySessionIfNeeded(
183 190
						new LazyInitializationWork<Boolean>() {
184 191
							@Override
......
317 324

  
318 325
	protected Boolean readIndexExistence(final Object index) {
319 326
		if ( !initialized ) {
327
			//##REMOTING-KEEP##
320 328
			// In remoting we are sure that session is null
321 329
			// both when using property paths and switching off conversations
322 330
			if(session == null && remoting) {
323 331
				LOG.info("--> readIndexExistence, of " + getRole() + " with key " + getKey());
324 332
				read();
325
			} else {  //keep formatting to ease update to newer hibernate version
333
			} else {
334
		    //keep formatting below to ease update to newer hibernate version
335
			//##REMOTING-KEEP END##
326 336
			final Boolean extraLazyExistenceCheck = withTemporarySessionIfNeeded(
327 337
					new LazyInitializationWork<Boolean>() {
328 338
						@Override
......
352 362

  
353 363
	protected Boolean readElementExistence(final Object element) {
354 364
		if ( !initialized ) {
365
			//##REMOTING-KEEP##
355 366
			// In remoting we are sure that session is null
356 367
			// both when using property paths and switching off conversations
357 368
			if(session == null && remoting) {
358 369
				LOG.info("--> readElementExistence, of " + getRole() + " with key " + getKey());
359 370
				read();
360 371

  
361
			} else {  //keep formatting to ease update to newer hibernate version
372
			} else {
373
		    //keep formatting below to ease update to newer hibernate version
374
			//##REMOTING-KEEP END##
362 375
			final Boolean extraLazyExistenceCheck = withTemporarySessionIfNeeded(
363 376
					new LazyInitializationWork<Boolean>() {
364 377
						@Override
......
390 403

  
391 404
	protected Object readElementByIndex(final Object index) {
392 405
		if ( !initialized ) {
406
			//##REMOTING-KEEP##
393 407
			// In remoting we are sure that session is null
394 408
			// both when using property paths and switching off conversations
395 409
			if(session == null && remoting) {
396 410
				LOG.info("--> readElementByIndex, of " + getRole() + " with key " + getKey());
397 411
				read();
398 412

  
399
			} else {  //keep formatting to ease update to newer hibernate version
413
			} else {
414
		    //keep formatting below to ease update to newer hibernate version
415
			//##REMOTING-KEEP END##
400 416
			class ExtraLazyElementByIndexReader implements LazyInitializationWork {
401 417
				private boolean isExtraLazy;
402 418
				private Object element;
......
617 633
		if ( initialized ) {
618 634
			return;
619 635
		}
636
		//##REMOTING-KEEP##
620 637
	    // In remoting we are sure that session is null
621 638
	    // both when using property paths and switching off conversations
622 639
	    if(session == null && remoting) {
623 640
	        remoteInitialize();
624
	    } else { //keep formatting to ease update to newer hibernate version
625
		withTemporarySessionIfNeeded(
641
	    } else { 
642
	    //keep formatting below to ease update to newer hibernate version
643
		//##REMOTING-KEEP END##
644
	    withTemporarySessionIfNeeded(
626 645
				new LazyInitializationWork<Object>() {
627 646
					@Override
628 647
					public Object doWork() {
......
1355 1374
		this.owner = owner;
1356 1375
	}
1357 1376

  
1358
/** #################################################################### 
1377
	
1378
/** ##REMOTING-KEEP## ####################################################### 
1359 1379
    
1360
    ADDED PART: Below is section of code which makes remote service calls 
1380
    ADDED PART: Below is the section of code which makes remote service calls.
1381
    Keeps this code when upgrading to newer hibernate version. Also keep
1382
    other code marked with ##REMOTING-KEEP## in the following 5 methods:
1361 1383
    
1362
    #################################################################### */
1384
    {@link #initialize(boolean)}
1385
	{@link #readSize()}
1386
	{@link #readIndexExistence(Object)}
1387
	{@link #readElementExistence(Object)}
1388
	{@link #readElementByIndex(Object)}
1389
    
1390
    ######################################################################### */
1363 1391
    
1364
	
1365
	// The affected methods are :
1366
	// initialize(final boolean writing)
1367
	// readSize()
1368
	// readIndexExistence(final Object index)
1369
	// readElementExistence(final Object element)
1370
	// readElementByIndex(final Object index)
1371

  
1372 1392
	private static CdmApplicationRemoteConfiguration configuration;
1373 1393
	private static boolean remoting = false;
1374 1394

  
......
1423 1443
			}
1424 1444
		}
1425 1445
	}
1446
    // ##REMOTING-KEEP END##
1426 1447
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)