-->
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.  [ 1 post ] 
Author Message
 Post subject: Composite ID
PostPosted: Wed Apr 12, 2006 11:40 am 
Newbie

Joined: Wed Apr 12, 2006 10:48 am
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

We are using composite-PK in Database wich is having one auto-increment column. When inserting a new row i am not assigning the value for the second column. When I returned serialisable object it is giving null value for that column even though database insertion happend. This is happening while using this composite-id as foreign key.

The scenario is like this
Declare the composite-user type in hibernate with both assigned as given below,

<id name="eventCompId" type="EventUserTypeId">
<column name="event_id"/>
<column name="event_version"/>
</id>


The business scenario is like this once a row is created for the entity, user updates and changes the second column, which is assigned. We need to save this as second row(infact a insert) with first column being saved with same id.

compsite pk is like this for event column,

CREATE TABLE `event` (
`event_id` int(30) unsigned NOT NULL auto_increment,
`event_version` int(10) unsigned NOT NULL default '1',
.....
.....
PRIMARY KEY (`event_id`,`event_version`),
...
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Thanks for any help forthcoming.

Srihari.

Hibernate version:3.0

Name and version of the database you are using:Mysql 5.0.18


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.