-->
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: 2 column composite Id, one is a sequence, the other fk
PostPosted: Wed Jan 26, 2005 12:28 pm 
Newbie

Joined: Thu Jan 13, 2005 10:15 pm
Posts: 3
Location: San Salvador
There´s any way to do a composite id, where one of the colums is an oracle sequence and the other is a foreign key to other table?

Hibernate version: Hibernate2

Mapping documents:
.
.
.

<composite-id class="MENUSPK" name="Id">
<key-property
column="ID_MENU"
name="IdMenu"
type="integer"
/>
<key-many-to-one
class="Roles"
column="COD_ROL"
name="CodRol"
/>
.
.
.

Name and version of the database you are using:ORACLE 9i


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 26, 2005 12:41 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
hum hum

just one question: do you think the sequence property isn't enough to manage your model unicity?
;)

not so hard

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject: OK... you´re rigth
PostPosted: Thu Jan 27, 2005 10:42 am 
Newbie

Joined: Thu Jan 13, 2005 10:15 pm
Posts: 3
Location: San Salvador
Yeah, the sequence is enough, but maybe I didn´t made the correct question, I wanted to know if there was a way to tell hibernate to increment sequences using a generator flavor like sequence in it´s tag, but I used a prepared statement to do that, and I got the connection from hibernate of course... :-) and used assigned in the tag. Thaks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 27, 2005 11:11 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
why don't you map the sequence generated column as id

and the many-to-one as a simple many-to-one with not-null = true?

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


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.