users
[Top] [All Lists]

hibernate problem

To: users@xxxxxxxxxx
Subject: hibernate problem
From: Trey Howard <trey.howard@xxxxxxxxxxxxxxxx>
Date: Thu, 16 Sep 2004 16:17:51 -0400
Delivered-to: mailing list users@cinjug.org
Mailing-list: contact users-help@cinjug.org; run by ezmlm
User-agent: Mozilla Thunderbird 0.8 (Windows/20040913)
Hi All

I'm having a problem with getting a hibernate mapping to work.

I have a parent, class Timeline, that has children, class Launcher.

Here is the xdoclet hibernate mapping in Timeline for the Launcher set
@hibernate.set table="timeline_launcher" cascade="none"
@hibernate.collection-key column="parent_timeline"
@hibernate.collection-one-to-many class="fqns.Launcher"

Here is the xdoclet hibernate mapping in Launcher for the parent Timeline
@hibernate.collection-key column="parent_timeline"
@hibernate.collection-many-to-one class="fqns.Timeline"


The problem is that when I retrieve a child Launcher instance, the field for the parent Timeline shows null, whereas the database shows the correct value.
For instance:
I have a Timeline id=1 and create a new Launcher and .saveOrUpdate() it to give it an id of 4.
The Launcher (POJO) will return that its parent Timeline is 1 (this is what's in the database, also).
However, if I then perform a .load(4), the Launcher (POJO) will return a null parent Timeline.


So, it appears as though I can save the parent-child relationship, but I can't retrieve it.
Do I need to specify an option to one of the above mappings to achieve the functionality I described?


In case it matters, I'm running MySQL 3.23.58

Any help would be appreciated!
-Trey


<Prev in Thread] Current Thread [Next in Thread>