I am trying to set up an h2 database for testing. Problem is that when I try to run a test I get an error: ids for this class must be manually assigned before calling save()
even though the super class has the id. Is this just a bad entity design or is something wrong with me configuration?
superclass:
@MappedSuperclass
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class Data {
@Id
protected Long NB_ID;
protected String FG_STATUS;
@Column(name="FG_ETAT")
protected String FG_ETAT;
protected String LB_ETAT;
getters/setters
subclass:
@Entity
@Table(name="ERESIS.ECH_HISEXPCOM")
public class CustomerDelivery extends Data{
protected String CD_COM1;
protected Integer NO_LIGNE;
protected String CD_MAT;
protected Double QT_NET;
getters/setters
my config:
nav.datasource.url=jdbc:h2:mem:sanders_20180813_nemanja;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
nav.datasource.username=sa
nav.datasource.password=sa
nav.datasource.driver-class-name=org.h2.Driver
nav.datasource.max-idle=2
nav.datasource.min-idle=2
nav.datasource.initial-size=2
nav.jpa.show-sql=true
nav.jpa.hibernate.ddl-auto=create
nav.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
nav.jpa.properties.connection.CharSet=utf8
nav.jpa.properties.connection.characterEncoding=utf8
nav.jpa.properties.hibernate.connection.useUnicode=true
nut.datasource.url=jdbc:h2:mem:NUTRICIEL_SYNC;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
nut.datasource.username=sa
nut.datasource.password=sa
nut.datasource.driver-class-name=org.h2.Driver
nut.datasource.max-idle=2
nut.datasource.min-idle=2
nut.datasource.initial-size=2
nut.datasource.testOnBorrow=true
#nut.datasource.validationQuery=SELECT 1 FROM DUAL
nut.jpa.show-sql=true
nut.jpa.hibernate.ddl-auto=create
nut.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
nut.jpa.properties.connection.CharSet=utf8
nut.jpa.properties.connection.characterEncoding=utf8
nut.jpa.properties.hibernate.connection.useUnicode=true