-->
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: Multiple @Id problem
PostPosted: Tue Sep 27, 2011 5:22 am 
Newbie

Joined: Wed Mar 05, 2008 10:01 am
Posts: 3
Hello.
I have problem with mapping table without primary key. My table has two columns witch must have unique vale so in fact they are my primary key, booth columns are date type.
In class which mapping table I put annotation @Id on booth properties (validFrom and validTo).
e.g.
Code:
public class MyTable {

        @Id
        @Temporal( TemporalType.DATE)
   @Column(name="TOSD_VALID_FROM", nullable=false)
   private Date validFrom;

        @Id
        @Temporal( TemporalType.DATE)
   @Column(name="TOSD_VALID_TO", nullable=false)
   private Date validTo;

        ..... other fields

}




Now I have two problems:
1. When I loading data e.q. "select u from MyTable u" I haven’t value for second column marked as primary key only first have value (of course value is in table).
2. When I wan to save data only value for first field is sending to DB which cause exception because id can't be null

Hibernate 3.2.4.sp1


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