-->
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.  [ 1 post ] 
Author Message
 Post subject: Question in regards to interfaces.
PostPosted: Wed Jul 06, 2005 5:02 pm 
Newbie

Joined: Wed Jul 06, 2005 4:19 pm
Posts: 6
I have the following class:

Code:
public class TimeCard
{
   public long ID { get... set... }
   public string WorkDescription {...}
   public IProject Project {...}
   public IEmployee Employee {...}
   public DateTime InTime {...}
   public DateTime OutTime {...}
}

public interface IProject
{
   long ID{ get; }
}

public interface IEmployee
{
   long ID{ get; }
}



The idea here is to persist the TimeCard class in one table, and also persist the IProject/IEmployee interfaces in the same table (I guess by using <component>in the mapping), by accessing their respective ID properties and saving them into the TimeCard table.

How would I set up the mapping for this? I dont need to persist the actual implementation of the IEmployee interfaces, just the ID reference in the TimeCard table.

I tried setting it up by just mapping the timecard class, and with <component> sections for each of the interfaces, but it throws an error saying "Could not load type IProject from assembly NHibernate".

One obvious problem seems to be loading the TimeCard object with the Employee/Project properties, since Hibernate only has an Interface as a reference, but no "real" object to put the values in (unless its able to use reflection to construct and serve up the appropriate "dummy" objects).

Anyways.. thankful for suggestions/answers..

// Christian


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.