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?