Revision 53fc098d
Added by Andreas Müller almost 2 years ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java | ||
---|---|---|
1479 | 1479 |
Object collectionType = null; |
1480 | 1480 |
Field field = null; |
1481 | 1481 |
Class<?> clazz = null; |
1482 |
String codePart = "1"; |
|
1482 | 1483 |
try { |
1483 | 1484 |
String role = getRole(); |
1484 | 1485 |
String fieldName = role.substring(role.lastIndexOf(".") + 1); |
1485 | 1486 |
LOG.info("--> Remote Lazy Initializing Collection " + getRole() + " , owner : " + getOwner().getClass() + "/" + getKey() + " , field : " + fieldName); |
1486 | 1487 |
Object owner = getOwner(); |
1487 | 1488 |
CdmBase cdmBase; |
1489 |
codePart = "2"; |
|
1488 | 1490 |
if(owner instanceof CdmBase) { |
1489 | 1491 |
cdmBase = (CdmBase)owner; |
1490 | 1492 |
} else { |
... | ... | |
1493 | 1495 |
if(configuration == null) { |
1494 | 1496 |
throw new HibernateException("CdmApplicationRemoteConfiguration not initialized (null)"); |
1495 | 1497 |
} |
1498 |
codePart = "3"; |
|
1499 |
|
|
1496 | 1500 |
ICachedCommonService cachedCommonService = configuration.getCachedCommonService(); |
1497 | 1501 |
if(cachedCommonService == null) { |
1498 | 1502 |
throw new HibernateException("commonService not initialized (null)"); |
1499 | 1503 |
} |
1504 |
codePart = "4"; |
|
1500 | 1505 |
|
1501 | 1506 |
//Object obj = ProxyUtils.deproxyIfInitialized(cachedCommonService.initializeCollection(this)); |
1502 | 1507 |
Object obj = ProxyUtils.deproxyIfInitialized(cachedCommonService.initializeCollection(cdmBase.getUuid(), fieldName)); |
1503 | 1508 |
if(ProxyUtils.isUninitializedProxy(obj)) { |
1504 | 1509 |
throw new HibernateException("Persistent Collection initialized but is still a proxy"); |
1505 | 1510 |
} |
1511 |
codePart = "5"; |
|
1506 | 1512 |
afterInitialize(); |
1507 | 1513 |
|
1508 | 1514 |
clazz = getClass(); |
1515 |
codePart = "6"; |
|
1509 | 1516 |
if (clazz != null) { |
1510 | 1517 |
collectionType = ProxyUtils.getCollectionType(obj, clazz); |
1511 |
field = clazz.getDeclaredField(collectionType.toString()); |
|
1518 |
codePart = "7"; |
|
1519 |
field = clazz.getDeclaredField(collectionType.toString()); |
|
1520 |
codePart = "8"; |
|
1512 | 1521 |
field.setAccessible(true); |
1513 | 1522 |
field.set(this, obj); |
1514 |
ProxyUtils.setRoleValueInOwner(owner, role, obj);
|
|
1523 |
codePart = "9";
|
|
1515 | 1524 |
|
1525 |
ProxyUtils.setRoleValueInOwner(owner, role, obj); |
|
1516 | 1526 |
} |
1517 | 1527 |
} catch (Exception ex) { |
1518 | 1528 |
String originalMessage = ex.getMessage(); |
1519 |
String message = originalMessage + "clazz: " + (clazz == null? "" :clazz.getSimpleName())+ "- field: " + field + " - collectionType: " + collectionType;
|
|
1529 |
String message = originalMessage + ", clazz: " + (clazz == null? "" :clazz.getSimpleName())+ ", field: " + field + ", collectionType: " + collectionType + ", at code part: " + codePart;
|
|
1520 | 1530 |
throw new CdmEagerLoadingException(message); |
1521 | 1531 |
} |
1522 | 1532 |
} |
Also available in: Unified diff
improve logging for exception in AbstractPersistentCollection.remoteInitialize()