-->
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.  [ 8 posts ] 
Author Message
 Post subject: @IdClass, composite keys, and field access
PostPosted: Fri Oct 28, 2005 8:01 pm 
Newbie

Joined: Mon Jun 06, 2005 11:21 pm
Posts: 10
I am having trouble using Hibernate Annotations with composite keys and field access. I'll take an example out of the annotations manal. The following classes, when initialized in the session factory are throwing an UnsupportedOperationException.

Code:
@Entity(access=AccessType.FIELD)
@IdClass(FootballerPk.class)
public class Footballer {
    public String firstname;
    public String lastname;
    public String club;
    //appropriate equals() and hashCode() implementation
}

public class FootballerPk implements Serializable {
    public String firstname;
    public String lastname;
    //appropriate equals() and hashCode() implementation
}


The code works, of course, if I change the access attribute and add getters and setters. Is there a principled reason why this should be illegal that I am not understanding?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 8:13 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Full stack trace.
FYI the reference code is also part of the test suite, so it should work.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 31, 2005 6:17 pm 
Newbie

Joined: Mon Jun 06, 2005 11:21 pm
Posts: 10
On my call to buildSessionFactory(), I get:

Quote:
testHibernate(test.net.opencookbook.TestHibernate)java.lang.UnsupportedOperationException
at org.hibernate.util.EmptyIterator.next(EmptyIterator.java:18)
at org.hibernate.util.JoinedIterator.next(JoinedIterator.java:53)
at org.hibernate.cfg.AnnotationBinder.bindId(AnnotationBinder.java:1493)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:573)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:256)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:191)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1138)
at test.net.project.TestHibernate.testHibernate(TestHibernate.java:30)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 5:47 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Which H3.1 version are you using? Same for HA version?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 6:17 pm 
Newbie

Joined: Mon Jun 06, 2005 11:21 pm
Posts: 10
Hibernate 3.1 RC2
Hibernate Annotations 3.1 Beta 6


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 7:14 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Post a runnable test case in JIRA, I cannot reproduce with Hib and HA HEAD

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 04, 2005 7:03 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
You've forgotten @Embeddable(access = AccessType.FIELD) in FootballerPK

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 04, 2005 7:09 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I've made the exception message more explicit

_________________
Emmanuel


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