Hi all,
i'm using hibernate entity manager and annotations.
i have an entity object with an id column defined like this:
Code:
@Id
@Column(name = "id")
@GeneratedValue(generator = "UserIdSeq")
@SequenceGenerator(name = "UserIdSeq", sequenceName = "user_id_seq")
public Long getId() {
return _id;
}
This seems to work fine in normal application execution.
When it doesn't work fine is when i try to unit test my DAOs. I'm using an in memory HSQL database for my tests and every time i try to create an entity i get this error:
Quote:
java.sql.SQLException: Attempt to insert null into a non-nullable column: column: ID table: USERS
The persistence.xml used to run the tests looks like this:
Code:
<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
<class>com.logical.sites.contentlibrary.data.database.User</class>
<class>com.logical.sites.contentlibrary.data.database.Country</class>
<class>com.logical.sites.contentlibrary.data.database.LoomyLicense</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:testdb://localhost:9001"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
</properties>
</persistence-unit>
Any idea what might be wrong ?
Thanks in advance