[hibernate-issues] [Hibernate-JIRA] Created: (ANN-467) Inheritence of Embedded objects (@Embeddable)
Jean Paul Ebejer (JIRA)
noreply at atlassian.com
Wed Oct 18 11:53:24 EDT 2006
Inheritence of Embedded objects (@Embeddable)
----------------------------------------------
Key: ANN-467
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-467
Project: Hibernate Annotations
Type: Bug
Environment: JBoss 4.0.4, MYSQL 5.0.18, Java JDK 1.5.0_06
Reporter: Jean Paul Ebejer
Hi there @Hibernate (must be a pretty often repeated joke in here...)
I have an @Embeddable object AllocationId which extends another @Embeddable
object (GenericId). AllocationId, is simply a marker class and has NO attributes in it,
while all attributes (String id; which I want to persist) are in GenericId (inherited in AllocationId).
I get the following exception:
org.hibernate.AnnotationException: com.xxx.yyy.AllocationId has no persistent id property
at org.hibernate.cfg.AnnotationBinder.bindId(AnnotationBinder.java:1714)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1171)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:706)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:452)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:268)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1039)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1207)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:844)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:382)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:102)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor144.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Any Ideas ?
Code snippets as follow:
@Embeddable
public final class AllocationId extends GenericId {
// ... serial UID here - removed as considered somewhat sensitive ...
/**
* @param id
*/
public AllocationId(final String id) {
super(id);
}
}
@Embeddable
public abstract class GenericId implements Serializable {
/**
* The actual Id
*/
protected String id; // THIS IS NOT BEING 'SEEN' AS INSIDE AllocationId
/**
* Constructor to create a generic Id.
* Syntactic checks are performed here (not null and empty string)
*
* @param allocationId The allocation Id
*/
protected GenericId(final String id) {
validate(id);
this.id = id;
}
/**
* Performs syntactic checking of the generic id
*
* @param id may not be null or empty ""
*/
private void validate(final String id) throws IllegalArgumentException {
if (id == null) {
throw new IllegalArgumentException("id cannot be null");
}
if (id.trim().length() == 0) {
throw new IllegalArgumentException("id cannot be length 0");
}
}
/**
* @return the id
*/
public String getId() {
return this.id;
}
@Override
public String toString() {
return getId();
}
// some less interesting code here .equals overrides etc.
}
Let me know.
Many Thanks - for your attention and for your GREAT product,
Malta (MT).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list