-->
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.  [ 3 posts ] 
Author Message
 Post subject: Annotations, Class is its own composite key
PostPosted: Tue Jan 31, 2006 1:00 pm 
Newbie

Joined: Mon Dec 26, 2005 12:35 pm
Posts: 7
Hello,

I have a problem with the following schema:
Code:
Class X {
String a;
String b;
}


a and b make the class' composite key.

I could work without a problem with that class using a hibernate mapping file.
Code:
<hibernate-mapping>
    <class name="X">
        <composite-id>
            <key-property name="a" type="string">
            </key-property>
            <key-property name="b" type="string">
            </key-property>
        </composite-id>
    </class>
</hibernate-mapping>


When I tried to use annotations instead (starting a move towards ejb3 annotations), I couldn't make it work.

I tried something like
@Entity
@Embeddable
@IdClass(X.class)
public class X

returns:
org.hibernate.AnnotationException: No identifier specified for entity: X

If I add @Id to both properties, I have:
Caused by: org.hibernate.AnnotationException: X has not persistent id property

when creating the annotation configuration instance.


Is this too weird?
I'd like to avoid duplicating the class just to have a PK class...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 4:23 am 
Newbie

Joined: Mon Dec 26, 2005 12:35 pm
Posts: 7
bump... nobody?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 6:54 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This is not supported yet

_________________
Emmanuel


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