-->
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.  [ 2 posts ] 
Author Message
 Post subject: Custom id Generator
PostPosted: Mon Jan 23, 2006 4:21 am 
Newbie

Joined: Mon Jan 23, 2006 4:07 am
Posts: 1
Hi,

The problem I am facing is with repsect to PK of the table. One of them is using oracle sequence and the other is a foreign key of another table which is like a CONSTANT (A number).

When I need to insert data for the object instance, I have to use the compsoite key (one for oracle sequnce and other for the constant).
1. How do I write the custom Id generator for this?
2. How do I mention the id generator in my mapping file?

<composite-id name="id" class="OrdKey" >
<key-many-to-one name="brn" column="BRN" class="Branch" />
<key-property name="ordId" column="ORD_ID" type="java.lang.String" >
</key-property>
</composite-id>

how do make the ORD_ID to be picked up from oracle sequence in the above mapping file. I can't use the <generator class="sequence"> since this is composite id.

Hibernate version: 3

Name and version of the database you are using: Oracle 9i
[/b][/code]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 11:51 pm 
Regular
Regular

Joined: Tue Dec 14, 2004 5:21 am
Posts: 104
Location: india
why dont u try writting a custom generator class by implementing IdentifierGenerator
and map it as
<generator class="yourclass" />

i'm not sure if this fits ur requrements

_________________
sHeRiN
thanks for your ratings ...... :)


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