You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Vincenzo D'Aniello <ic...@gmail.com> on 2016/10/14 14:06:55 UTC

Re: Null field not persisted for Dates

Hi, i've set this property in the persistence unit:

<property name="openjpa.DetachState" 
 value="loaded(DetachedStateField=true)"/> 

but when the entity object try to be detached, an exception
NoSuchMethodException is thrown because openjpa try to execute the
writeExternal method on the entity class object.

I have not understand abaut enhancer, Enhancement. There is a complete
example how do remote ejb call with ejb entity beans?

I use Tomee 1.7.4 naturally with openejb, openjpa, sorry for my english.



--
View this message in context: http://openjpa.208410.n2.nabble.com/Null-field-not-persisted-for-Dates-tp5993519p7589809.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Null field not persisted for Dates

Posted by Vincenzo D'Aniello <ic...@gmail.com>.
Ok it was what I wanted, an example of the most comprehensive jpa enhancement
applied to OpenJPA.

I missed the part of the plug-in OpenJPA in maven, and so everything is
clear.

Now for reasons of time, I settled with the java reflections, but when I
have some time I'll try with this solution, and I think that will definitely
work.

Thanks for your help!



--
View this message in context: http://openjpa.208410.n2.nabble.com/Null-field-not-persisted-for-Dates-tp5993519p7589816.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Null field not persisted for Dates

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Hi Vincenzo!

No worries, your english is fine. 

The writeExternal is invoked to serialize away the entity. Whether the receiver side gets just the normal entity fields (unenhanced so to say) or also the _loaded and _dirty fields is a question of the configuration. 

I usually use the following setup:
https://github.com/struberg/lightweightEE/blob/master/backend-api/src/main/resources/META-INF/persistence.xml#L26

Together with the openjpa-maven-plugin to enhance the classes at build time
https://github.com/struberg/lightweightEE/blob/master/backend-api/pom.xml#L66
I should clean up the connection section config. That's a left over from many years back. But it should basically work.

I've wrote up a bit about enhancement strategies many years ago, maybe it helps:
https://struberg.wordpress.com/2012/01/08/jpa-enhancement-done-right/


Do you have a small sample which we can use to reproduce the problem?

txs and LieGrue,
strub





> On Saturday, 15 October 2016, 19:25, Vincenzo D'Aniello <ic...@gmail.com> wrote:
> > Hi, i've set this property in the persistence unit:
> 
> <property name="openjpa.DetachState" 
> value="loaded(DetachedStateField=true)"/> 
> 
> but when the entity object try to be detached, an exception
> NoSuchMethodException is thrown because openjpa try to execute the
> writeExternal method on the entity class object.
> 
> I have not understand abaut enhancer, Enhancement. There is a complete
> example how do remote ejb call with ejb entity beans?
> 
> I use Tomee 1.7.4 naturally with openejb, openjpa, sorry for my english.
> 
> 
> 
> --
> View this message in context: 
> http://openjpa.208410.n2.nabble.com/Null-field-not-persisted-for-Dates-tp5993519p7589809.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>