Hi
I have an entity with
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
public long getId() {
return id;
}
I have application that is replicated on 2 servers each working with 2 equal data bases. I persist entity on server1 and after that send the entity via jms to server2 which must persist the same entity too. But it throws me exception
javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: MyEntity
because the entity have set PK id and the persistence menager thinks it is already persisted. How can i have AUTO generated value and the same time to set PK id when i need?