This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

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

 
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?
 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!