Skip to content
Advertisement

Tag: embeddable

Using Java records as JPA embeddables

I want to use Java records as embeddable objects with JPA. For example I want to wrap the ID in a record to make it typesafe: But If I try to persist it with Hibernate 5.4.32 I get the following error: So it looks like Hibernate would treat the record Id like an entity, although it is an @Embeddable. The

hibernate h2 embeddable list expected “identifier”

I’m trying to associate a list of function (whom Embeddable) within my Employee Entity and H2 seems unhappy with this saying that it expected an “identifier” Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement ” CREATE TABLE EMPLOYEE_FUNCTIONS ( EMPLOYEE_EMPLOYEEID VARCHAR(255) NOT NULL, ACTIVE BOOLEAN NOT NULL, DEPARTMENTNUMBER INTEGER NOT NULL, DESCRIPTION VARCHAR(255), ORDER[*] INTEGER NOT NULL ) “; expected

Advertisement