Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

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?
 
Liar, liar, pants on fire! refreshing plug:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic