This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Hibernate Criteria, Query by Example and "nullable=false"

 
Peter Wagner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i am using Hibernate Criteria with "Query by Example" and have some problems when i set "nullable=false" for OneToMany mapping inside my entities.
The problem is, that the generated SQL query is not the one i expected.

Here is my example code:

Person.java:


PersonenStichwort.java:


PersonenDao.java:


SQL Query generated by Hibernate:


As you can see, Hibernate inserts "personenst1_.bp_personenid=?" inside the sql-where-clause, cause personenStichworte in Person.java is mapped with "nullable=false". How can i force Hibernate to exclude this property without
changing nullable to true? (I have already tested Example.create(personenStichwort).excludeProperty("bp_personenid"), but doesn't work as well)

Best regards

Peter
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic