Skip to main content

[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 Andreas,

  The bug you are listing refers to attributes that are not mapped.  It appears you are experiencing this issue with attributes that are mapped.  The idea is that we use this _persistence_new() method to get a more efficient creation of the object and then use our knowledge of the mapped attributes to copy them or populate them.  For transient fields, we cannot do that - hence the bug and its fix.

  How are the converters you are seeing NPEs in defined?   Do they check attributes other than the ones they are converting in their conversion code?  Can you provide a sample including a stack trace, the converter, the object being converted and any relevant mappings.

Thanks,
Tom

On 21/09/2013 7:38 PM, Andreas Joseph Krogh wrote:
På lørdag 21. september 2013 kl. 13:49:02, skrev Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>:
På lørdag 21. september 2013 kl. 13:34:04, skrev Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>:
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?
 
One more thing; What optimizations does eclipselink.weaving.internal provide? I found this: http://www.eclipse.org/eclipselink/documentation/2.4/jpa/extensions/p_weaving_internal.htm#BABJICDJ , but it didn't explain anything other than some internal optimization".
 
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
 


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top