-->
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.  [ 3 posts ] 
Author Message
 Post subject: More than one hibernate sequence for two table?
PostPosted: Thu Dec 13, 2007 11:13 pm 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
In my project I have to write work flow trace to a history tables. As it may grow exponentially, I would like to use a separate sequence. And this table has no relation with other entities.

So can I have more than one sequence in my hibernate mappings. I need one to generate ids when entities are saved. And the other one for history entity.

How can I specify the id generator property for history entity to use second sequence. I am using Oracle 9i.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 15, 2007 10:50 am 
Newbie

Joined: Tue Nov 27, 2007 6:11 am
Posts: 12
I don't understand very well your problem, but maybe this can help you:
http://www.hibernate.org/296.html


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 17, 2007 6:51 am 
Newbie

Joined: Wed Jan 31, 2007 9:55 pm
Posts: 16
i'm using oracle sequence and here's my mapping file:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="com.test.vo.SequenceVO"
table="DUAL"
dynamic-insert="true"
optimistic-lock="version"
>

<id
name="num"
column="num"
type="long"
>
<generator class="assigned">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-Sequence.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Sequence.xml
containing the additional properties and place it in your merge dir.
-->

</class>

<sql-query name="get_message_id_seq">
<return alias="seq" class="com.test.vo.SequenceVO"/>
select msg_id_seq.nextval as {seq.num} from dual
</sql-query>

<sql-query name="get_user_session_id_seq">
<return alias="seq" class="com.test.vo.SequenceVO"/>
select SEQ_USER_SESSION_ID.nextval as {seq.num} from dual
</sql-query>

<sql-query name="get_instruction_id_seq">
<return alias="seq" class="com.test.vo.SequenceVO"/>
select SEQ_INSTRUCTION_ID.nextval as {seq.num} from dual
</sql-query>

</hibernate-mapping>


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