Monday, December 5, 2011

Hibernate: wrong usage of merge()

Note the wrong usage of merge():

merge() doesn't make the object passed into it persistent, it returns another instance with the same state instead,

So you should write: bean.setManufacturer(s.merge(bean.getManufacturer()));

 

 

No comments:

Post a Comment