Hello,
I get from Hibernate Tools this mapping file:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 23, 2007 4:53:05 PM by Hibernate Tools 3.2.0.beta8 -->
<hibernate-mapping>
<class name="de.fhg.scai.bio.csr.io.database.hibernate.Item" table="ITEM">
<id name="id" type="int">
<column name="ID" precision="22" scale="0" />
<generator class="assigned" />
</id>
<property name="type" type="string">
<column name="TYPE" length="45" />
</property>
<set name="moleculeses" inverse="true">
<key>
<column name="ITEM_ID" precision="22" scale="0" not-null="true" unique="true" />
</key>
<one-to-many class="de.fhg.scai.bio.csr.io.database.hibernate.Molecules" />
</set>
</class>
</hibernate-mapping>
Bit instead of
Code:
<generator class="assigned" />
I want
Code:
<generator class="sequence">
<param name="sequence">item_seq</param>
</generator>
The problem is that I have a lot of tables where I always have the same problem. Every time the primary key name is "id" and type is "INTEGER". The name of the sequence is always "<tablename>_seq". I know I could write a skript that changes this for me, but it would be the best if hibernate could do this directly for me.
Greetz Carina
Hibernate version: 3.2 beta 8
Name and version of the database you are using: Oracle 10g
Create Statement of the tables:Code:
CREATE TABLE item (
id INTEGER NOT NULL ,
type VARCHAR(45) NULL,
PRIMARY KEY(id)
);
CREATE TABLE molecules (
item_id INTEGER NOT NULL,
name VARCHAR(100) NULL,
smiles VARCHAR(100) NULL,
iupac VARCHAR(100) NULL,
inchi VARCHAR(100) NULL,
formula VARCHAR(100) NULL,
createBy VARCHAR(100) NULL,
nofAtoms INT NULL,
nofBonds INT NULL,
nofHeavyAtoms INT NULL,
nofHeavyBonds INT NULL,
nofFragments INT NULL,
nofSuperAtoms INT NULL,
nofRings INT NULL,
nofRGroups INT NULL,
medianBondLength DOUBLE PRECISION NULL,
mass DOUBLE PRECISION NULL,
directory VARCHAR(100) NULL,
workflowID INTEGER NULL,
PRIMARY KEY(item_id),
FOREIGN KEY(item_id)
REFERENCES item(id)
);
CREATE SEQUENCE item_seq
start with 1
increment by 1
nomaxvalue;