JPA Version column isn't updating after merge()

1k views Asked by At

I'm updating an entity via EntityManager#merge() but the new JPA version number from JPA isn't being reflected correctly in the returned entity.

@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 should I deal with this? Thanks!

0

There are 0 answers