-->
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: primary key and reveng.xml file
PostPosted: Mon Jun 04, 2007 12:57 pm 
Newbie

Joined: Wed Nov 08, 2006 11:54 am
Posts: 4
Hello

Hibernate tools: org.hibernate.eclipse_3.2.0.beta8

I would like to replace part describing primary key in hbm.xml file generated by hbm2hbmxml ant task. It looks like that:

Code:
<id name="id" type="big_decimal">
            <column name="ID" precision="22" scale="0" />
            <generator class="assigned" />
</id>


But there is a sequence in database, and i want to use that sequence. So i decided to describe that in reveng.xml file. My file looks like that:

Code:
<hibernate-reverse-engineering>
     <schema-selection match-schema="SCHEMA" match-table="MYTABLE" />
   
     <table name="MYTABLE">
          <primary-key>
               <generator class="sequence">
                    <param name="sequence">mytable_seq</param>
               </generator>
               <key-column name="ID" />
          </primary-key>
     </table>

</hibernate-reverse-engineering>


But that doesn't work at all. Generated hbm.xml file is still the same.
My ant task:

Code:
<target name="generate-mappings-classes">
     <hibernatetool destdir="${dest-dir}" >
          <jdbcconfiguration configurationfile="resource/ant/dev.cfg.xml"
                         revengfile="resource/ant/hibernate.reveng.xml"/>
          <hbm2hbmxml />
          <hbm2java />
     </hibernatetool>
</target>


Did anyone face a problem like described?
Looks for me like a bug :(. I hope this is my fault, is it?

Thank you for any help
vitor_b


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 04, 2007 3:41 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
try and set schema on the <table>

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 04, 2007 3:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
or set hibernate.default_schema to the schema you want to filter in.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Many thanks
PostPosted: Tue Jun 05, 2007 4:41 am 
Newbie

Joined: Wed Nov 08, 2006 11:54 am
Posts: 4
Setting attribute schema on element <table> is the solution :)
Thank you very much Max.

vitor_b

P.S. This solution looks almost obvious for me now :)


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.