-->
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: Annotations/ManyToOne/Composite Key error
PostPosted: Fri Nov 20, 2009 12:11 pm 
Newbie

Joined: Mon Nov 16, 2009 7:23 am
Posts: 7
I'm having problems using annotations to refer to a non-primary key set of columns in another table. The referenced columns are part of a unique key, so this should work.

I think this is one of the "edge case limitations" discussed in bug ANN-623, where it's said that "non PK target is supported". Therefore I think this is a bug in Hibernate.

I would file a bug report, but the comment by Emmanuel Bernard on that bug, which was closed due to lack of a test case, says to post in the forum first, so I am. I have a reproducible test case (JUnit class and HBM mapping file).

The error that I get is:

org.hibernate.AnnotationException:
referencedColumnNames(project_id, site_id) of UserRole.projectSite
referencing ProjectSite not mapped to a single property

Which is in some sense true, because it's mapped to a <properties> element with a unique attribute, but this works when the mapping comes from an HBM file, and I can't find another way to do it (and keep the associations) from an annotated class.

Combined with bug HHH-4595, which stops me from moving the referenced mapping from HBM to an annotated class, this has stopped my migration from HBM to annotations cold.

Please let me know if you can help, if you think this is a bug or not, or whether I should post to the bug tracker.


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.