-->
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: Employee->Manager hibernate(actually NHibernate) issue
PostPosted: Tue Aug 31, 2004 3:48 pm 
Newbie

Joined: Tue Aug 31, 2004 3:39 pm
Posts: 1
Ok..
So I am new to Hibernate(actually NHibernate)...Let me get that out real quick.

Anyway-
Using Hibernatel to do some dev with an Employee->Manager class structure..
Looks like this->
class Employee
{
blah
Employee myManager (so Manager is of type Employee)
blah
}

In the DB there is an Employee table, with EmployeeID as the PK
There is a ManagerID that points back to EmployeeID to get the manager.

Now here is the issue...ManagerID can be null, or have an ID that has not been mapped into the DB yet...so to not be able to go snag the manger is cool...but I cannot seem to figure out the correct HBM syntax to tell hibernate that its ok not to be able to go get the Manager type. Right now Hibernate trys to go walk the db hooking the Employess up with their Managers...but its gonna fail...and I cannot get the query to return.

Here is my HBM
<class name="BaseTPMP.valueobjects.Employee, BaseTPMP" table="refEmployee" >
<id name="EmployeeID" column="EmployeeID" unsaved-value="0" >
<generator class="assigned" />
</id>
<property name="FirstName" column= "FirstName"/>
<property name="LastName" column= "LastName"/>
<many-to-one name="Manager" class="BaseTPMP.valueobjects.Employee, BaseTPMP" column="ManagerID" />

Can I do what I am trying to do with Hibernate?
Help?
Matthew

_________________
Matthew Drooker-Work


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 13, 2004 4:30 pm 
Newbie

Joined: Wed Aug 27, 2003 11:23 am
Posts: 4
http://sourceforge.net/forum/forum.php?forum_id=252014


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.