Details
Description
Integration test generated from a database reengineered Entity with a primary key of type string currently fail with:
org.springframework.orm.jpa.JpaSystemException: org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String; nested exception is javax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String
Solution: remove
@GeneratedValue(strategy = GenerationType.AUTO)
from the field annotated with @ID for privileged aspect Whatever_Roo_Entity
and make sure the primary key is set to something useful before the entity is persisted, e.g
@Entity @RooJavaBean @RooToString @RooEntity(identifierType = String.class, identifierField = "securityquestionId", identifierColumn = "securityquestion_id") @RooDbManaged @Table(name = "t_securityquestion") public class TSecurityquestion { @PrePersist public void generateSecurityQuestionId() { setSecurityquestionId(java.util.UUID.randomUUID().toString()); } }
Attachments
Issue Links
- is duplicated by
-
ROO-2424 IdentifierGenerationException creating an entity generated with DBRE
-
- Resolved
-