Hi,
I noticed that when merging an entity into a persistence context, the merged copy resets all @Transient fields to null.
For example:
EntityManager em = emf.createEntityManager();
Declaration decl = em.find(Declaration.class, 63L);
em.clear();
em.close();
decl.setStatus(DeclarationStatus.ACCEPTED); // modify a @Transient field
em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
Declaration mergedDecl = em.merge(decl);
System.out.println("decl. status=" + decl.getStatus());
System.out.println("merged status=" + mergedDecl.getStatus());
tx.commit();
The output is:
decl. status=ACCEPTED
merged status=null
Could anybody tell me what's the intended behaviour of JPA? Are the @Transient fields supposed to be reset?
I tried with TopLink Essentials v2-b41 and v2-b52.
Best regards,
Bisser