-->
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.  [ 5 posts ] 
Author Message
 Post subject: Use sequence generator with Oracle 9
PostPosted: Fri Apr 15, 2005 2:59 am 
Newbie

Joined: Fri Jan 07, 2005 3:57 am
Posts: 16
Hi all,

I'm using Hibernate 3.0, I want to use the sequence generator with Oracle 9. But in the specification and Hibernate in Action I couldn't find an example how to mapping the generator with the name of the sequence I have defined in Oracle. I suppose this is trivial when you have done the first time, but until that moment...

Best Regards


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 4:21 am 
Newbie

Joined: Fri Feb 04, 2005 9:45 am
Posts: 8
Location: Czech Republic
Hi Rodolfo,

I am not shure if I understood you well, but for getting sequence in hibernate for given sequence name, you can use something like this.

Dialect dialec = Dialect.getDialect(super.getProperties());
String nextvalString = dialec.getSequenceNextValString("SEQSIGNAT");

But still I have no idea how to run nextvalString, so I have use the JDBC statement.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 4:27 am 
Newbie

Joined: Fri Jan 07, 2005 3:57 am
Posts: 16
OK, thank you.

I thought it was possible to say the name of the secuence in the mapping.xml file and when you make an insert, Hibernate automaticly takes the next value an inputs. Anycase if you need to generate the next val by hand, in this case you can define the class generator as "assigned".

It would be possible to make transparent the fact of generate the next value. What do you think?

Best Regards

Rodolfo


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 1:26 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Code:
<class ...>
    <id ...>
        <generator class="sequence">
            <param name="sequence">your_sequence_name</param>
        </generator>
    </id>
</class>


http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-id-sequences


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 18, 2005 1:51 am 
Newbie

Joined: Fri Jan 07, 2005 3:57 am
Posts: 16
Thanks Steve


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.