• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate : ternary association mapped by a map (like book page 347)

 
pascal gehl
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a unidirectional ternary association like page 347 of the book between
Person (Category in the book), Category (Item in the book) and Career (User in the book).
The difference is that the person_id and the category_id are not nullable but the Career_id can be null in the association table.
When I try to save a Person with a Category in the key of the map but null in the value.
No insert occurs in the PERSON_CATEGORY table.

Is there a way of "telling" hibernate in the mapping to insert a line in PERSON_CATEGORY if the career is null ?


works perfectly well but when I try to read the person with id2 the null Career doesn't appear.

Here my unit test fails because my Map is empty. And it shouldn't because the "manual" insert worked well.

thanks

Paskos

Here are my details.

Hibernate version:3.2.2 ga

Mapping documents:



Code between sessionFactory.openSession() and session.close():



Name and version of the database you are using: hsqldb v 1.8

The generated SQL (show_sql=true):
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic