posted 14 years ago
I am using JBoss5.1.0GA (hibernate) and Oracle XE.
A book can have one or multiple authors (as reflected below)
When I persist a book, it contains a collection of authors. I want the authors also to be persisted (cascade)
I have three tables.
BOOK_TBL
BOOK_ID (PK)
BOOK_AUTHOR_TBL
BOOK_ID (FK)
AUTHOR_ID (FK)
AUTHOR_TBL
AUTHOR_ID (PK)
I have two Entities:
Code snippets:
Book
Author
Nothing special here, except I use a sequence for the PK
When I persist my book, I get:
So it seems it's trying to insert the FK's in the mapping table but can't find the parent key yet.. What am I doing wrong?