-->
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: (beginner) Using id from another, sequence table
PostPosted: Fri Dec 17, 2004 12:33 pm 
Newbie

Joined: Fri Dec 17, 2004 12:17 pm
Posts: 5
I have object table and object_id_seq table.
Mapping works fine until I need to add new one to database. Then I need to use id from object_id_seq and that's the problem.
How can I configure mapping to use id from object_id_seq table when new object is created?
And object_id_seq table always have one row and one column which is id. Can hibernate support such sequence table using mapping xml or I need to use SQL?

This suggested configuration doesn't fit the case because it uses db sequence feature;
<class name="Object" table="object">
<id
column="id"
name="id"
type="java.lang.Long"
>
<generator class="sequence">
<param name="sequence">object_id_seq</param>
</generator>
</id>

Do I need to create separate mapping for sequence table and then manually update it or it can be done with mapping config?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 17, 2004 12:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Write a custom generator. Take HiLoGenerator as a model.


Top
 Profile  
 
 Post subject: What about inbuild generators
PostPosted: Fri Dec 17, 2004 5:45 pm 
Newbie

Joined: Wed Oct 13, 2004 11:23 am
Posts: 14
If the database is firebird, I can have seperate generator for each table. Can I configure hibernate to use it ?

--Anand


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 17, 2004 10:23 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
sure


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 18, 2004 2:43 pm 
Newbie

Joined: Fri Dec 17, 2004 12:17 pm
Posts: 5
Isn't my solution to use HiLo generator?
I am trying to understand what kind of generator I need to write and it seems that HiLo does exactly what I need.
Or I am missing something?


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