How to implement update () method in DAO using EntityManager (JPA)?

According to the JPA specifications EntityManager#merge() will return a reference to another object than the one passed in when the object was already loaded in the current context. So, I'd rather return the result of the merge() and write the update() method like this.

According to the JPA specifications, EntityManager#merge() will return a reference to another object than the one passed in when the object was already loaded in the current context. So, I'd rather return the result of the merge() and write the update() method like this: @PersistenceContext private EntityManager em; public User update (User transientUser) { return em. Merge(transientUser); } Then, use it like this (skipping the initialization part): user.

SetPhone("YYYYYY"); user = dao. Update(user).

Change the property and then use EntityManager merge() java.sun.com/javaee/5/docs/api/javax/per....

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions