Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate One to Many Mapping inserting only the first object

 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using one to many mapping and trying to store few records. I am using Spring 3 with Hibernate 3.
Mapping

When I execute this example . Only the first object "test attachment 111" gets inserted in the database.
The second one "test attachment 222" does not get inserted in the database.


This is the service

This is in the DAO.


Am I missing any confuguration ?

Thanks


 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys am I missing enough information in the post ?
Please let me know.
 
Christian Dillinger
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That cannot be the code you execute because you do not create a connection between Research "r" und Set<ResearchAttachment> "reslist".
 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My bad. Corrected code.


 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys any suggestions would be really helpful
 
ignacio garcia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Justin Howard wrote:Guys any suggestions would be really helpful


Hello,
I'm having the same problem with JPA, can anyone help with that, thanks
 
ignacio garcia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have resolved the problem was that the two object have the same id, so it don't insert the second
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic