I've created a table using liquibase:
<createTable tableName="employees">
<column name="id" type="bigint">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="name" type="varchar(50)">
<constraints nullable="false"/>
</column>
</createTable>
The following sql ddl query is generated:
CREATE TABLE employees (id BIGINT NOT NULL, name VARCHAR(50) NOT NULL, CONSTRAINT PK_EMPLOYEES PRIMARY KEY (id));
The corresponding entity:
@Entity
@Table(name="employees")
public class EmployeeAccessProperty ...
@Id
@GeneratedValue
public long getId() {
return id;
}
...
Now, when I try to save it via JPA implementation, the sql query is generated to insert data:
Hibernate: insert into employees (id, name) values (default, ?)
2013-05-20T14:29:22.525+0700 WARN SQL Error: -5544, SQLState: 42544
2013-05-20T14:29:22.526+0700 ERROR DEFAULT keyword cannot be used as column has no DEFAULT
I expected, that when I don't specify id generation strategy, Hibernate will choose the best one according to the provider. I don't understand why for ID generation the default value is tried to be used. I'm not sure, which side is responsible for the error: hibernate, liqubase or hsqldb.
What can I do to resolve the problem? Please help me.