• 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
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Whats wrong with the code ?

 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


What is the problem with the above code? The enties works well when I try to persist them in isolation. I am trying to persister these objects in a single trasaction.

There is no problem with the database, as it works well when executed by persisting the objects one by one ...
 
author
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Bad karma to access the EM from within the entity class.

2) Your relationship is not properly mapped. Try this:


3. You should probably set the id in employee to not be generated so you can assign it when you create one and then use the assigned id value to find it later on. Otherwise you won't know what id value got assigned to the employee unless you hold on to it, etc.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!