Digital Marketing

How to solve: JPA eclipselink: during the execution of the query was detected to be null. Primary keys must not contain null

EclipseLink is case sensitive by default unless the eclipselink.jpa.uppercase-column-names persistent property is set to true. This might be the problem for native queries if the database returns the column name as upper-case "ID" when you have it defined as lower-case "id". Try changing the column definitions in the annotations to match what your database uses or adding the property with a value of true.

In persistence.xml:
<properties>
<property name="eclipselink.target-server" value="SunAS9"/>
<property name="eclipselink.logging.level" value="ALL"/>
<property name="eclipselink.logging.level.sql" value="ALL"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="eclipselink.jdbc.batch-writing" value="JDBC"/>
<property name="eclipselink.target-database" value="MySQL"/>
<property name="eclipselink.jpa.uppercase-column-names" value="true"/>
</properties>

Comments

Popular posts from this blog

MySQL Sandbox with the Sakila sample database