• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mapping question (many-to-many via composite key)

 
Andy Page
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am struggling with "collection is not associated with any session" exception. this is what i have:



one client can have many rules:


same rule can belong to many clients



i would like to load all clients and for each client load all rules that belong to it. all in one shot as my app initializes.

it seems like the best way to map is to use <set> inside of the client and either map it as a value or an entity:



or



in both cases i get "collection is not associated with any session" exception when i run hibernateTemplate.loadAll(Client.class); if i remove the <set> from Client mapping file, everything works fine, so my hibernate machinery is OK.



any suggestions on how this mapping can be changed?

thank you.
[ March 29, 2008: Message edited by: Andy Page ]
 
Andy Page
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the interesting thing is that when i load each individual client via hibernateTemplate.load(Client.class, id), everything works just fine: i go through all client ids, load each one and everything works as expected; and yet hibernateTemplate.loadAll(Client.class) fails with "collection is not associated with any session"
 
Andy Page
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any takers?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic