users@glassfish.java.net

Re: Mapping problem

From: <glassfish_at_javadesktop.org>
Date: Thu, 11 Oct 2007 15:13:59 PDT

There is no JPA way to have zeros interpreted as nulls. ln TopLink you could extend the database platform you are using and implement the getObjectFromResultSet() method to return null for zeros. convertToDatabaseType would also have to be extended to convert from nulls to zeros for the trip back to the database. These changes would have the effect of converting all zeros to nulls even @Basic mappings. To resolve this you would then need to use a customizer to call setNullValue(0) on all @Basic mappings (represented by the TopLink class DirectToFieldMapping).

This pattern of using zeros to represent no relationship is limiting in general. Not sure of all side effects but for one it eliminates your option of ever using outer joins. You should attempt to migrate away from this pattern.
-Gordon
[Message sent by forum member 'gyorke' (gyorke)]

http://forums.java.net/jive/thread.jspa?messageID=239621