I have two objects to persist; Account and Role. Account has a
String username, a String password and a Set of Roles. Role has a String name, and a Set of Accounts. Hibernate creates a join table called accountroles to manage the Sets' many-to-many relationship. Everything works fine; Hibernate generates the correct SQL as far as I can tell. I inserted intermediate commits at each step just to make sure. On the last commit, I get a java.lang.StackOverflowError. I assume this has something to do with the bidirectional nature of the relationship. I must be getting an infinite loop of recursion or something. Any idea what I did wrong?
Thanks!
Hibernate version:
version 3.0.2 , 27.04.2005
Config file:
Mapping documents:
Account.hbm.xml
Role.hbm.xml
Code between sessionFactory.openSession() and session.close():
Schema-export.sql:
Full stack trace of any exception that occurs:
java.lang.StackOverflowError (that's it)
Name and version of the database you are using:
hsqldb_1_7_3_3
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: