-->
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: Possible bug when using internal non-static class as id?
PostPosted: Thu Sep 21, 2006 11:04 am 
Beginner
Beginner

Joined: Tue Nov 22, 2005 5:33 am
Posts: 31
I have a class with an internal embeddedId:

Code:
@Entity
public class OneEntity implements Serializable {
   
   EntityKey entityKey;

   @EmbeddedId
   public EntityKey getNumOfDecisionsHandEntityKey() {
      return entityKey;
   }

   public void setEntityKey(
         EntityKey entityKey) {
      this.entityKey = entityKey;
   }
   
   @Embeddable
   public class EntityKey implements Serializable{
      // ... some fields with getters and setters

      @Override
      public int hashCode() {
         //...
      }

      @Override
      public boolean equals(Object obj) {
         // ...
      }
   }
}


Note that the internal class is not static.

When I build a query against this entity, I get the following exception:

org.hibernate.InstantiationException: No default constructor for entity:OneEntity$EntityKey

When I change the class declaration to static, everything is working fine.

To me, this seems lilke a bug. Shouldn't the exception say something like "no containing class found"?

Should I post a bug report?


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.