Hibernate version:
3.2
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="com.wazollc.alphatheory.hibernate.bo">
<class name="RoleBO"
table="`ROLE`"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
lazy="true"
batch-size="6"
>
<id name="id" type="java.lang.Long" column="`roleID`">
<generator class="native">
<param name="sequence">at_sequence</param>
</generator>
</id>
<version name="version" type="java.lang.Long" access="field" column="OBJ_VERSION"/>
<property name="created" column="`created`" type="timestamp"
not-null="false" />
<property name="modifiedUserFullName"
column="`modifiedUserFullName`" type="java.lang.String"
not-null="false" />
<property name="modified" column="`modified`" type="timestamp"
not-null="false" />
<property name="roleName" column="`roleName`"
type="java.lang.String" not-null="false" />
<property name="createdUserID" column="`createdUserID`"
type="java.lang.Long" not-null="false" />
<property name="modifiedUserID" column="`modifiedUserID`"
type="java.lang.Long" not-null="false" />
<property name="createdUserFullName"
column="`createdUserFullName`"
type="java.lang.String" not-null="false"
/>
</class>
</hibernate-mapping>
Name and version of the database you are using:
postgresql-8.1.9
Hi all, I'm migrating our production hibernate app from sql server to postgres. I've searched the forums a bunch and I'm unable to explain why the generated ddl doesn't follow this form, as shown from the postgres docs:
http://www.postgresql.org/docs/8.2/stat ... table.html
Code:
CREATE TABLE distributors (
did integer PRIMARY KEY DEFAULT nextval('serial'),
name varchar(40) NOT NULL CHECK (name <> '')
);
The hibernate mapping document I use above with hibernate tools doesn't create a ddl with 'serial' or most importantly, doesn't have nextval. It does, however, have a sequence.
Code:
create table "ROLE" ("roleID" int8 not null, OBJ_VERSION int8 not null, "created" timestamp, "modifiedUserFullName" varchar(255), "modified" timestamp, "roleName" varchar(255), "createdUserID" int8, "modifiedUserID" int8, "createdUserFullName"
varchar(255), primary key ("roleID"));
...
create sequence at_sequence;
Is nextval as part of the 'create table' not mandatory? Is int8 ok to use as the PK instead of 'serial'? Will hibernate call nextval with my sequence at runtime on new inserts and is that all I need? Sorry if these are more suited as postgres questions, but the hibernate generated DDL is different than what I'm reading from the postgres docs.
Thanks for any clarification!
Robert