File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Problem with Hibernate Criteria, Query by Example and Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem with Hibernate Criteria, Query by Example and "nullable=false"" Watch "Problem with Hibernate Criteria, Query by Example and "nullable=false"" New topic
Author

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

Peter Wagner
Greenhorn

Joined: Oct 29, 2009
Posts: 3
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Hibernate Criteria, Query by Example and "nullable=false"
 
Similar Threads
Clarification needed in usuage of Example criteria.
Hibernate Many to Many criteria conjuction
JPA query optimization
Problem with Hibernate Criteria, Projections and associations
Problem in Query By Example (Hibernate)