Forums Register Login

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

+Pie Number of slices to send: Send
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):
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 3597 times.
Similar Threads
Mapping Exception
Column appears twice - Hibernate generated prepared statement
Repeated updates on EVENT table, in Hibernate one to many mapping
inverse=true in many-to-many doubt
Hibernate - ObjectDeletedException: deleted object would be re-saved by cascade...
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:28:20.