Craig
On Apr 3, 2009, at 1:52 PM, Michael Dick wrote:
Have you tried the following ? <basic name="numericDisplay"> <column name="NUMERIC_DISPLAY" nullable="false"/> <enumerated>STRING</enumerated> </basic>By default OpenJPA doesn't check for constraints on your columns. So if your mappings (or annotations) aren't consistent with the constraints in thedatabase you can run into problems.Alternatively you can configure OpenJPA to read the data from the databaseby adding this property : <property name="openjpa.jdbc.SchemaFactory" value="native"/>If you've tried either of those and we're still persisting a null value thenit's definitely a bug. -mikeOn Fri, Apr 3, 2009 at 1:51 PM, Craig L Russell <[email protected]>wrote:Hi Adam, Sounds like a bug. Can you please file a JIRA? Thanks, Craig On Apr 3, 2009, at 9:26 AM, Adam Hardy wrote:Just tested this with static enhancement against mysql and have the sameproblem. OpenJPA is inserting a blank string into the not-null field whenthe the enum variable is null. Is this a bug or to be expected? Regards Adam Adam Hardy on 01/04/09 17:38, wrote:I have an entity bean with this property in v1.2.0 and H2 db: <basic name="numericDisplay"> <column name="NUMERIC_DISPLAY"/> <enumerated>STRING</enumerated> </basic>I just discovered that I can set the property on the bean to null andsave it to a field in the DB with a not-null constraint. It saves a zero-length string. On reading back the row however OpenJPA throws this: <openjpa-1.2.0-r422266:683325 nonfatal general error>org.apache.openjpa.persistence.PersistenceException: No enum const classorg.permacode.patternrepo.PatternRepoNumericDisplay.Surely this is inconsistent? Shouldn't I get an error when trying to dothe write first of all?Admittedly I have yet to test it with pre-enhanced beans but I figured itwould be the same (or is that a completely different code base?)Craig L Russell Architect, Sun Java Enterprise System http://db.apache.org/jdo 408 276-5638 mailto:[email protected] P.S. A good JDO? O, Gasp!
Craig L Russell Architect, Sun Java Enterprise System http://db.apache.org/jdo 408 276-5638 mailto:[email protected] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
