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

På mandag 23. september 2013 kl. 17:28:54, skrev Christopher Delahunt <christopher.delahunt@xxxxxxxxxx>:
Hello Andreas,

The weaved performance enhancement is specifically designed for your
application, as it is extra processing to assign the none value and then
again assign the value from the database.  I believe it is only a
problem because your converter is run before the value gets set from the
database.

One solution would be to order the mappings so that the value required
is set before the values that have converters that might use it.  This
would be done with a descriptor customizer that used the
DatabaseMapping.setWeight(Integer) api to increase the weight value on
mappings with converters:
http://www.eclipse.org/eclipselink/api/2.3/org/eclipse/persistence/mappings/DatabaseMapping.html#setWeight(java.lang.Integer)

An other is to just turn off the internal weaving optimizations since
you do not want to bypass the default constructor.  The only way to know
the cost though is to do performance testing.
 
The section on eclipselink.weaving.internal should say with a big fat warning something like; "Enabling this will render your constructor useless as all fields of the class will be uninitialized", and as this is default-behaviour it should be easy to find.
 
It'd be *really* cool if one could disable the constructor-optimization only as it unexpectedly breaks the contract for the class for people not familiar with internals of EL.
 
--
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
 

Back to the top