Hi everyone, I'm getting this strange error on attempting to insert a row. I already found and read through several similar occurrences here in the forum, and although these gave me some sort of idea about the issue, I still can't see how to work around this.
Okay, here's a more detailed sitrep: I am working on a JavaFX program that uses H2 in embedded mode to store data in a local database (for now). I'm not using JDBC directly, but running through JPA with DataNucleus as persistence provider. The product versions are: - jdk1.8.0_121 - h2-1.4.193 - DataNucleus 5.0.7 In one window I deal with 2 tables (seperately), basically doing CRUD operations. Among other things there is an 'Add' button for each table - which, of course, implements INSERTing a new record via JPA persist. One of the 2 buttons works like a charm. Using the other one, however, raises an exception: Caused by: javax.persistence.PersistenceException: Cannot set Object parameter: value = 0 for column "ODDLOOT.BASE.ACCOUNT.ACCOUNTTYPEID" : Unerlaubter Wert "0" für Parameter "parameterIndex" Invalid value "0" for parameter "parameterIndex" [90008-193] At first, this misled me into thinking there is a problem with the default value for column ODDLOOT.BASE.ACCOUNT.ACCOUNTTYPEID, as it references another table and 0 would not be a valid value. I had not been worrying about the default values generated by DataNucleus, because the database itself holds defaults values for these columns, and it works smoothly on the other table that is handled by this window. But to be sure, I used a DataNucleus extension (@PrePersist) to even set the value originally set by DataNucleus to 1 - which would be valid. Here's the result: Caused by: javax.persistence.PersistenceException: Cannot set Object parameter: value = 1 for column "ODDLOOT.BASE.ACCOUNT.ACCOUNTTYPEID" : Unerlaubter Wert "0" für Parameter "parameterIndex" Invalid value "0" for parameter "parameterIndex" [90008-193] Thus, this is not the origin of the problem. Searching for similar incidents told me that it is related to the numbering of parameters in prepared statements. Obviously enough, I still have 2 issues here: 1. DataNucleus creates the prepared statements, i got no control here 2. The same thing works with the other table I already checked the code several times and most thoroughly compared the 2 persistance classes about a dozen times - to no avail. Any ideas/suggestions, anyone? Any help greatly appreciated. Cheers, Carsten -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
