FDS needs a way to indicate that "0" on the client side means null on
the server... unfortunately that did not make it in 2.0.1 but I have it
on my list for the next release.   One workaround for this would be to
extend the assembler and override the createItem method.  If the id is 0
in that class, just set it to null in the Java object.  I assume the
Java object has an "Integer" rather than an "int" so this is possible.

 

Jeff

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Carlos Rovira
Sent: Friday, January 19, 2007 1:23 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] [FDS2+Spring/Hibernate] VOs reaching the backend
with id=0 ("unsaved-value" problem)

 

Hi,

I'm switching from Toplink to Hibernate using JPA/EJB3 and Annotations.
I'm facing a problem with this change due to the fact that when I try to
persist new entities Hibernate throws a "PersistenceObjectException:
Detached entity passed to persist". Hibernate expects new entities with
ID = NULL and my new entities reach the hibernate layer with ID = 0. 

If I were using hibernate xml config files (hbm.xml) I could use
"unsaved-value = 0" (for each entity), but I'm using Annotations and
there's no "unsaved-value" annotation to use.

So, anyone reach this problem? How could I change the default
configuration in Hibernate so new entities with ID = 0 will be
considered as the default.

Or maybe there's a way in FDS2 to configure default value to null? 

Thanks for any light on this :)

C.




-- 
::| Carlos Rovira
::| http://www.carlosrovira.com <http://www.carlosrovira.com> 
::| http://www.madeinflex.com <http://www.madeinflex.com>  

 

Reply via email to