-->
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.  [ 3 posts ] 
Author Message
 Post subject: SessionFactory error: Association references unmapped class:
PostPosted: Mon Nov 20, 2006 7:29 am 
Newbie

Joined: Tue Nov 07, 2006 7:13 am
Posts: 9
Location: Barcelona
Hi,
I need some help to solve some problem to map a many-to-many relationship. Finally I have introduced a new table so I have two relationships with this join table of one-to-many type:

RegistreEvents(1)------(N)EventsComunicats(N)------(1)DadesPersonals

I've shortened the code to avoid wasting your time:

public class RegistreEvents {
private int identifier;
private String subject;
private String body;
private modulInformacioEvents.RegistreEvents event;
private modulPersonal.DadesPersonals fromWho;
private java.util.Collection toWhom = new java.util.TreeSet();
...
}

public class EventsComunicats {
private DadesPersonals persona;
private Events eventId;
...
}

public class DadesPersonals {
private int identifier;
private String nom;
private String cognom1;
private String cognom2;
private String DNI;
private java.util.Collection email = new java.util.TreeSet();
private java.util.Collection telefons = new java.util.TreeSet();
private java.util.Collection registraEvent = new java.util.TreeSet();
private java.util.Collection repEvent = new java.util.TreeSet();
...
}

And the following XML stuff is how I mapped this classes:

<hibernate-mapping package="modulInformacioEvents">
<class name="RegistreEvents" table="RegistreEvents">
<id name="identifier" column="identifier" />
<property name="subject" column="subject" />
<property name="body" column="body" />
<many-to-one name="event" column="identifier" class="Events" />
<many-to-one name="fromWho" column="identifier" class="DadesPersonals" />
<set name="toWhom" inverse="true">
<key column="eventId" />
<one-to-many class="EventsComunicats" />
</set>
</class>
</hibernate-mapping>


<hibernate-mapping package="modulInformacioEvents">
<class name="EventsComunicats">
<composite-id name="identifier" class="EventsComunicats">
<key-property name="eventId" column="eventId" />
<key-property name="persona" column="persona" />
</composite-id>
<many-to-one name="eventId" class="RegistreEvents" column="identifier" />
<many-to-one name="persona" class="DadesPersonals" column="identifier" />
</class>
</hibernate-mapping>


<hibernate-mapping package="modulPersonal">
<class name="DadesPersonals" table="DadesPersonals">
<id name="identifier" column="identifier" />
<property name="nom" column="nom" />
<property name="cognom1" column="cognom1" />
<property name="cognom2" column="cognom2" />
<property name="DNI" column="DNI" />
<set name="correuelectronic" inverse="true">
<key column="identifier" on-delete="cascade" />
<one-to-many class="CorreuElectronic"/>
</set>
<set name="telefons" inverse="true">
<key column="identifier" on-delete="cascade"/>
<one-to-many class="NumeroTelefon"/>
</set>
<set name="registraEvent" inverse="true">
<key column="identifier"/>
<one-to-many class="RegistreEvents" />
</set>
<set name="repEvent" inverse="true">
<key column="persona"/>
<one-to-many class="EventsComunicats" />
</set>
</class>
</hibernate-mapping>

Apparently there is some error with RegistreEvents class for in spite of my efforts I keep getting the sessionfactory error and the association references unmapped for this class gives me no message.

If you need further information just let me know; so DOES anyone have an idea how could I solve this? It's taking too long and I want to test my application.

Thanks in advance for your help.

Blai

_________________
Veles e vents han mos desig complir faent camins dubtosos per la mar.


Top
 Profile  
 
 Post subject: there is a misspelling
PostPosted: Mon Nov 20, 2006 11:45 am 
Newbie

Joined: Tue Nov 07, 2006 7:13 am
Posts: 9
Location: Barcelona
Hi, I've realised that there is a misspelling in one of the classes. Here you have the good version:

public class RegistreEvents {
private int identifier;
private String subject;
private String body;
private modulInformacioEvents.RegistreEvents event;
private modulPersonal.DadesPersonals fromWho;
private java.util.Collection toWhom = new java.util.TreeSet();
...
}

I still get the error: I've tried many-to-many map for the relationship and I've tried it with composite-id when the present approach but the error still comes up.

what should i do? Please help.

Blai

_________________
Veles e vents han mos desig complir faent camins dubtosos per la mar.


Top
 Profile  
 
 Post subject: THIS is the final version: sorry for disturbing
PostPosted: Tue Nov 21, 2006 5:02 am 
Newbie

Joined: Tue Nov 07, 2006 7:13 am
Posts: 9
Location: Barcelona
public class RegistreEvents {
private int identifier;
private String subject;
private String body;
private modulInformacioEvents.Events event;
private modulPersonal.DadesPersonals fromWho;
private java.util.Collection toWhom = new java.util.TreeSet();
...
}


This problem with some unmapped reference is driving me crazy,

could you PLEASE help me?

Thanks a lot,

Blai

_________________
Veles e vents han mos desig complir faent camins dubtosos per la mar.


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