JPA version column not updated after merge ()

I am updating the object via EntityManager#merge()

, but the new JPA version number from JPA is not reflected correctly in the returned object.

@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class LeadService {
    @PersistenceContext(name = "joose")
    private EntityManager em;

    public Lead createOrUpdateLead(Lead lead) {
        if (lead.getId() != null) {
            em.merge(lead);
        } else {
            em.persist(lead);
        }
        return lead;
    }

      

How can I deal with this? Thank!

+3


source to share





All Articles