I have a set of Java source files for which the hbm files are generated by XDoclet. All files are then packaged in a HAR file which is deployed on a JBoss Application Server and the DDL schema is automatically exported to a PostgreSQL 8.0 database server.
The following code is a sample from one of the Java sources:
Code:
/**
* @hibernate.id
* generator-class="sequence"
* type="java.lang.Integer"
* column="user_role_id"
* unsaved-value="0"
*
* @hibernate.generator-param
* name="sequence"
* value="UserRole"
*
*/
public Integer getUserRoleId() {
return this.userRoleId;
}
This is the corresponding part from the generated hbm file:
Code:
<id
name="userRoleId"
column="user_role_id"
type="java.lang.Integer"
unsaved-value="0"
>
<generator class="sequence">
<param name="sequence">UserRole</param>
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-UserRole.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
The problem is that the column "user_role_id" is defined as a simple int4 column on my PostgreSQL server, with no default value (which should be something like "nextval('UserRole')" ). All the sequence objects are properly generated in the database, they are just not used in the ID columns.
Can anyone help me?