-->
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.  [ 2 posts ] 
Author Message
 Post subject: error Association references unmapped class w/ annotation
PostPosted: Wed Feb 01, 2006 5:06 pm 
Newbie

Joined: Wed Feb 01, 2006 4:05 pm
Posts: 2
Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: hibernate-annotations-3.1beta7

I am using Hibernate inside JBoss 4.


I am trying to migrate to annotations from xdoclet mappings generating .hbm files. Some of the classes are in .hbm format while others are in annotation format. However, I get MappingException: Association references unmapped class even though I've configured hibernate to use AnnotationConfiguration. The error is issued upon Jboss startup, and as soon as it sees a class that has association to an annotated class, it bombs. I read that it's possible to mix annotations with .hbm files and I've followed the documentation on configuring hibernate with annotaiton, but it's still not working. I have tried several things including taking out all annotations except the basic @Entity. I have searched all over the net and this forum but without success. Please help!!!

Here is how I setup annotation configuraiton:

public class HibernateSession
{
private static final SessionFactory sessionFactory;

static {

try {
AnnotationConfiguration cfg = new AnnotationConfiguration();
cfg.addAnnotatedClass(com.foo.impl.Place.class);
sessionFactory = cfg.buildSessionFactory();
} catch (Exception ex) {
throw new RuntimeException("SessionFactory error: " + ex.getMessage(), ex);
}
}


Mapping documents:

Annotated class:

@Entity
@Table(name="place")
public class Place implements Serializable{

/** identifier field */
private String guid;

/** persistent field */
private String name;

/** nullable persistent field */
private String description;

/** nullable persistent field */
private String address;

/** default constructor */
public Place() {
}

@Id(generate = GeneratorType.NONE)
@Column(name="Place_GUID")
public String getGuid() {
return this.guid;
}

public void setGuid(String placeGuid) {
this.guid = placeGuid;
}

@Column(name="PlaceName", length=50)
public String getName() {
return this.name;
}

public void setName(String placeName) {
this.name = placeName;
}

@Column(name="PlaceDescription", length=50)
public String getDescription() {
return this.description;
}

public void setDescription(String placeDescription) {
this.description = placeDescription;
}

@Column(name="PlaceAddress", length=50)
public String getAddress() {
return this.address;
}
public void setAddress(String placeAddress) {
this.address = placeAddress;
}


The above class is referenced by non-annotated class. This class uses xdoclet to generate hibernatedoclet.

/**
* @hibernate.class
* table="organisation"
*
*/
public class Organisation implements Serializable{

/** identifier field */
private String guid;

/** persistent field */
private String name;

/** persistent field */
private Set places;

/** default constructor */
public Organisation() {
}

/**
* @hibernate.id
* generator-class="assigned"
* type="java.lang.String"
* column="Org_GUID"
*/
public String getGuid() {
return this.guid;
}

public void setGuid(String orgGuid) {
this.guid = orgGuid;
}


/**
* @hibernate.property
* column="OrgName"
* length="38"
* not-null="true"
*/
public String getName() {
return this.name;
}


public void setName(String orgName) {
this.name = orgName;
}

/**
* @hibernate.set
* lazy="true"
* cascade="all-delete-orphan"
* inverse="true"
* @hibernate.collection-key
* column="Organisation_GUID"
* @hibernate.collection-one-to-many
* class="com.foo.impl.Place"
*/
public Set getPlaces() {
return this.places;
}

public void setPlaces(Set places) {
this.places = places;
}




Exceptiton:

[exec] 14:55:04,825 INFO [HbmBinder] Mapping collection: com.foo.impl.Fieldreport.fieldreportgraphics -> fieldreportgraphic
[exec] 14:55:04,872 WARN [ServiceController] Problem starting service jboss.har:service=Hibernte
[exec] org.hibernate.MappingException: Association references unmapped class: com.foo.impl.Place
[exec] at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2271)
[exec] at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2794)
[exec] at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35)

[exec] at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1031)
[exec] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1146)
[exec] at org.jboss.hibernate.jmx.Hibernate.buildSessionFactory(Hibernate.java:199)
[exec] at org.jboss.hibernate.jmx.Hibernate.startService(Hibernate.java:131)
[exec] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:
274)
[exec] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.j
ava:230)
[exec] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[exec] at java.lang.reflect.Method.invoke(Unknown Source)
[exec] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)

[exec] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
[exec] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
[exec] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
[exec] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
[exec] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943
)
[exec] at $Proxy0.start(Unknown Source)
[exec] at org.jboss.system.ServiceController.start(ServiceController.java:428)
[exec] at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[exec] at java.lang.reflect.Method.invoke(Unknown Source)
[exec] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)

[exec] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
[exec] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
[exec] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
[exec] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
[exec] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
[exec] at $Proxy4.start(Unknown Source)
[exec] at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
[exec] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
[exec] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
[exec] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
[exec] at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[exec] at java.lang.reflect.Method.invoke(Unknown Source)
[exec] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)

[exec] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
[exec] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)

[exec] at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
[exec] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperatio
nInterceptor.java:127)
[exec] at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
[exec] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
[exec] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
[exec] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
[exec] at $Proxy6.deploy(Unknown Source)
[exec] at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.jav
a:319)
[exec] at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:
507)
[exec] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(Abstr
actDeploymentScanner.java:192)
[exec] at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeplo
ymentScanner.java:265)
[exec] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:
274)
[exec] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.j
ava:230)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[exec] at java.lang.reflect.Method.invoke(Unknown Source)
[exec] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)

[exec] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
[exec] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
[exec] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
[exec] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
[exec] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943
)
[exec] at $Proxy0.start(Unknown Source)
[exec] at org.jboss.system.ServiceController.start(ServiceController.java:428)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[exec] at java.lang.reflect.Method.invoke(Unknown Source)
[exec] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)

[exec] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
[exec] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
[exec] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
[exec] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
[exec] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
[exec] at $Proxy4.start(Unknown Source)
[exec] at org.jboss.deployment.SARDeployer.start(SARDeployer.java:285)
[exec] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:989)
[exec] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:790)
[exec] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)
[exec] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:737)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[exec] at java.lang.reflect.Method.invoke(Unknown Source)
[exec] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)

[exec] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
[exec] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)

[exec] at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
[exec] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperatio
nInterceptor.java:127)
[exec] at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
[exec] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
[exec] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
[exec] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
[exec] at $Proxy5.deploy(Unknown Source)
[exec] at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:453)
[exec] at org.jboss.system.server.ServerImpl.start(ServerImpl.java:330)
[exec] at org.jboss.Main.boot(Main.java:187)
[exec] at org.jboss.Main$1.run(Main.java:438)
[exec] at java.lang.Thread.run(Unknown Source)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 02, 2006 10:27 am 
Newbie

Joined: Wed Feb 01, 2006 4:05 pm
Posts: 2
Anybody out there that can help? I am getting this error when JBoss tries to deploy Hibernate.


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