java - JAXB unmarshalling to managed JPA entities -


i've got managed jpa entity (with subentities well). of fields of given entities should filled unmarshalling xml file retrieved datasource. problem jaxb not unmarshall xml existing objects create new object instead. simplest way solve problem?

instead of unmarshalling existing jpa object, should use jpa merge operation merge state of detached entity persistence context.

public void updateemployee(employee detachedentity) {    employee managedentity = entitymanager.merge(detachedentity);    // further operations on managedentity , not detachedentity } 

update

if using jpa 2.1 leverage entity graphs use case.


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -