Actually, according to the JPA specification it is forbidden to change a primary key:
The application must not change the value of the primary key[8]. The behavior is undefined if this occurs.[9]
(from EJB 3 persistence (JPA) specification, paragraph 2.1.4)
More Related Contents:
- Hibernate ID Generator
- Hibernate: Difference between session.get and session.load
- Hibernate: one-to-one lazy loading, optional = false
- How to use Spring managed Hibernate interceptors in Spring Boot?
- What is the difference between DAO and Repository patterns?
- @OrderColumn annotation in Hibernate 3.5
- How to query data for Primefaces dataTable using lazy loading and pagination
- Performing Date/Time Math In HQL?
- How to connect to multiple databases in Hibernate
- Spring Boot & Spring Data: how are Hibernate Sessions managed?
- Hibernate – why use many-to-one to represent a one-to-one?
- how to return Map with HQL
- Spring Data JPA – Pass column name and value as parameters
- hibernate could not get next sequence value
- Deleted object would be re-saved by cascade (remove deleted object from associations)
- Invalidating JPA EntityManager session
- How to generate a ddl creation script with a modern Spring Boot + Data JPA and Hibernate setup?
- Grails 2.4 and hibernate4 errors with run-app
- Hibernate/JPA ManyToOne vs OneToMany
- When to Use EntityManager.clear()?
- How is Hibernate deciding order of update/insert/delete
- Hibernate inserts duplicates into a @OneToMany collection
- What is the right way to use spring MVC with Hibernate in DAO, service layer architecture
- hibernate – get id after save object
- How to use JPA2’s @Cacheable instead of Hibernate’s @Cache
- Hibernate 3.6 – session.get() vs session.load()
- createEntityManager throws java.lang.NullPointerException at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus
- CDI injection in EntityListeners
- UnsupportedOperationException: The application must supply JDBC connections
- New object with HQL