[jboss-user] [EJB 3.0] - JoinColumns with AnnotationException
penguine
do-not-reply at jboss.com
Tue Aug 7 10:58:19 EDT 2007
in my entity I have the following annotation. I have generated the entities with DALI_0.5:
---------------BEGIN----------------------
@Entity
public class Stoerung implements Serializable {
@EmbeddedId
private Stoerung.PK pk;
...
private Aggregat nameaggregat;
@ManyToOne
@JoinColumns({
@JoinColumn(name="NAMEANLAGENTEIL", referencedColumnName="NAMEANLAGENTEIL"),
@JoinColumn(name="NAMEAGGREGAT", referencedColumnName="NAMEAGGREGAT")
})
private Anlagenteil anlagenteil;
.
.
.
.
----------------ENDE-------------------
the entity with the FK is the following:
------------ BEGIN------------------------
@Entity
public class Anlagenteil implements Serializable {
@EmbeddedId
private Anlagenteil.PK pk;
@ManyToOne
@JoinColumn(name="NAMEAGGREGAT")
private Aggregat nameaggregat;
@OneToMany(mappedBy="anlagenteil")
private Set stoerungCollection;
private static final long serialVersionUID = 1L;
public Anlagenteil() {
super();
}
public Anlagenteil.PK getPk() {
return this.pk;
}
public void setPk(Anlagenteil.PK pk) {
this.pk = pk;
}
public Aggregat getNameaggregat() {
return this.nameaggregat;
}
public void setNameaggregat(Aggregat nameaggregat) {
this.nameaggregat = nameaggregat;
}
public Set getStoerungCollection() {
return this.stoerungCollection;
}
public void setStoerungCollection(Set stoerungCollection) {
this.stoerungCollection = stoerungCollection;
..
..
..
-------------ENDE----------------
and the exception is:
---------BEGIN---------------
2007-08-07 16:13:24,000 DEBUG [org.hibernate.cfg.annotations.CollectionBinder] Collection role: com.mycompany.entity.Stoerungsgrund.stoerungCollection
2007-08-07 16:13:24,000 DEBUG [org.hibernate.cfg.annotations.PropertyBinder] Building property stoerungCollection
2007-08-07 16:13:24,000 DEBUG [org.hibernate.cfg.AnnotationConfiguration] processing manytoone fk mappings
2007-08-07 16:13:24,000 DEBUG [org.jboss.ejb3.ServiceDelegateWrapper] Starting failed persistence.units:jar=EnityTest.jar,unitName=Stoerzeit
org.hibernate.AnnotationException: referencedColumnNames(NAMEANLAGENTEIL, NAMEAGGREGAT) of com.mycompany.entity.Stoerung.anlagenteil referencing com.mycompany.entity.Anlagenteil not mapped to a single property
at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:165)
at org.hibernate.cfg.FkSecondPass.doSecondPass(FkSecondPass.java:63)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:428)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:286)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:407)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
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:103)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
.
.
.
.
--------------ENDE---------------------
has someone an idea?
Thanx for help
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071644#4071644
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071644
More information about the jboss-user
mailing list