-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: hbm2hbmxml : generator class with hsqldb
PostPosted: Sun Sep 17, 2006 1:17 pm 
Newbie

Joined: Sun Sep 17, 2006 12:54 pm
Posts: 2
Hi

I have following table in hsqldb 1.7.3 :
Code:
CREATE TABLE Company
(
   CompCode      INTEGER    identity,   
   CompName      VARCHAR(100)    NOT NULL,   
   PRIMARY KEY (CompCode)
);

and following hibernate.reveng.xml :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >

<hibernate-reverse-engineering>
<type-mapping>
   <sql-type jdbc-type="CHAR" hibernate-type="string" length="1">
   </sql-type>
   <sql-type jdbc-type="INTEGER" hibernate-type="java.lang.Integer">
   </sql-type>
</type-mapping>
</hibernate-reverse-engineering>

The generated hmb file is :
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 17 sept. 2006 18:42:43 by Hibernate Tools 3.2.0.beta6a -->
<hibernate-mapping>
    <class name="com.hmoser.repo.Company" table="COMPANY">
        <id name="compCode" type="java.lang.Integer">
            <column name="COMPCODE" />
            <generator class="assigned" />
        </id>
        <property name="compName" type="string">
            <column name="COMPNAME" length="100" not-null="true" />
        </property>
    </class>
</hibernate-mapping>

I was expecting : generator class="identity".
Am I missing something ?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 17, 2006 7:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Default generator is 'assigned' add more information to reveng
See http://www.hibernate.org/hib_docs/tools/reference/en/html/reverseengineering.html#d0e1477


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 18, 2006 4:32 am 
Newbie

Joined: Sun Sep 17, 2006 12:54 pm
Posts: 2
Thanks David

Does this means that I have to add a <primary-key> tag for each table in my reveng file ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 18, 2006 4:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you can also just implement a custom ReverseEngineeringStrategy and return "identity" from the getIdentifierStrategy method.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.