EclipseLink を
ボタン連打で、
対処したので、
EclipseLink の Version
- EclipseLink 2.6.3
<!-- Eclipse Link --> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>eclipselink</artifactId> <version>2.6.3</version> </dependency>
エラーの 内容
Exception [EclipseLink-7251] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.ValidationException Exception Description: The attribute [id] of class [xyz.monotalk.festivals4partypeople.models.rdb.entity.ContactMailTaskManage] is mapped to a primary key column in the database. Updates are not allowed. at org.eclipse.persistence.exceptions.ValidationException.primaryKeyUpdateDisallowed(ValidationException.java:2551) at org.eclipse.persistence.mappings.foundation.AbstractDirectMapping.writeFromObjectIntoRowWithChangeRecord(AbstractDirectMapping.java:1265) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildRowForUpdateWithChangeSet(ObjectBuilder.java:1769)
EntityManager に
key 値採番が
[1] key 値の
@GeneratedValue(strategy = GenerationType.IDENTITY)
を
対処方法
persistance.xml に
ウィービングに
[2] ウィービングと
<property name="eclipselink.weaving.internal" value="false"/>
しかし、
EntityManager#clear() を
参考記事
java - Merge an entity, change its id, merge again, cause “mapped to a primary key column in the database. Updates are not allowed” error - Stack Overflow
eclipselink.weaving.internal
の参考記事 EclipseLink JPA『
is mapped to a primary key column in the database. Updates are not allowed.』
EntityManage#clear() の参考記事
たまに
以上です。
コメント