Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.1.2
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
>
<class
name="net.sourceforge.lebon.model.VotingRight"
table="VotingRight"
>
<id
name="id"
column="ID"
type="java.lang.Long"
>
<generator class="assigned">
<param name="sequence">VTR_SEQ</param>
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-VotingRight.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>
<timestamp
name="modifiedAt"
column="modified_at"
access="property"
unsaved-value="null"
/>
<property
name="amount"
type="java.lang.Float"
update="true"
insert="true"
column="amount"
not-null="true"
/>
<property
name="modifiedBy"
type="java.lang.String"
update="true"
insert="true"
column="modified_by"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-VotingRight.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Hello,
I am moving a project to sequences and I need the ID generator class to be assigned so that I can assign the ID right after creating the entity object (I can't change that)..
The problem is hbm2ddl dosen't generate the "create sequence" part if the generator class isn't "sequence" (or that's how thing look at the moment)
So can anybody tell me how to "convince" hbm2ddl to generate something like this
Code:
insert into dual_USR_SEQ values (0);
create sequence USR_SEQ start with 1;
create table dual_VTR_SEQ (
zero integer
);
while using assigned as id class generator ?
thank you