[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] PersistenceObjectInstantiationPolicy.buildNewInstance null'ing out all fields of an object regardless of fields set by default-constructor
|
Hi all.
Short version:
org.eclipse.persistence.internal.descriptors.PersistenceObjectInstantiationPolicy.buildNewInstance() calls _persistence_new which seems to return an object not initialized by the default-construcotor.
[snip]
The entity containing the @Embeddable in question is @Cacheable and removing the @Cacheable annotation from it makes this problem go away.
This is due to the following code:
org.eclipse.persistence.mappings.AggregateMapping.mergeIntoObject() line 668:
if (targetAttributeValue == null || targetAttributeValue == sourceAttributeValue || !targetAttributeValue.getClass().equals(sourceAttributeValue.getClass())) {
Without caching, the targetAttributeValue "is not same as" sourceAttributeValue but when the entity is @Cacheable the memory-equals test passes and makes the code call buildNewMergeInstanceOf() which returns the invalid object (with all fields set to null).
However - I'd really like this entity to keep being @Cacheable so I'd appreciate a fix to this problem.
How can one argue that it will *ever* be OK to execute the weaved-in constructor instead of the default-constructor (if defined)?
Is there a way to disable execution of the weaved-in default-constructor only, or does one have to turn off internal weaving all together using eclipselink.weaving.internal=false?
Thanks.
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx> mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc