-->
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: Middlegen: generating .hbm.xml with sequence generators
PostPosted: Tue Jul 06, 2004 10:28 am 
Newbie

Joined: Tue May 25, 2004 8:50 am
Posts: 8
Hi,

I am using Middlegen to generate my mapping files directly from an Oracle database. All works well, except that I cannot get my id generators to use a certain sequence.

The code that is generated is:

Code:
    <id
        name="id"
        type="java.math.BigDecimal"
        column="ID"
    >
        <generator class="assigned" />
    </id>


But instead, I want to have it generate:

Code:
    <id
        name="id"
        type="java.math.BigDecimal"
        column="ID"
    >
       <generator class="sequence">
                <param name="sequence">xyz</param>
        </generator>
    </id>


Is this possible?

Thanks in advance for any help!

Arjan Huijzer


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 06, 2004 7:44 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Yes - Use the GUI, select the table then choose sequence from the key generator combo then enter your sequence name against it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 07, 2004 3:48 am 
Newbie

Joined: Tue May 25, 2004 8:50 am
Posts: 8
Thanks! I tried it and it all works fine.

Is this the only way to specify which generator to use? Or is it also possible to add some attribute to the table element in my build.xml file:

Code:
<table name="STM_OBJECT" singular="object" plural="objects" someAttribute="someValue" />


Arjan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 07, 2004 7:16 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
There is an attribute for sequence in the table tag that the hibernate plugin does not read at this point (its used in the EJB plugin). Its on my TODO list.

Alternatively, you can modify the preferences file approrpiately.


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.