-->
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: Mapping Value Objects to a different Database
PostPosted: Mon Mar 23, 2009 5:50 pm 
Newbie

Joined: Mon Mar 23, 2009 3:20 pm
Posts: 4
Hello all,

I have the following entity:

public class Request
{
public virtual int Id;
public virtual string Name;
public virtual string AssignedTo;
}

Let's say I want some more information about the AssignedTo field. In terms of the domain, the AssignedTo field is really an Employee. An employee comes from different server/database than the Request object and is immutable. I only need an Employee really for SELECT purposes.

What is the best way to create a mapping for this type of relationship? I have tried a few different things, but it seems to me the only way this will work is to create a new method that retrieves the information via an ad-hoc statement (using a linked server).

Technically, an employee is player in the domain, but the employee system has already been built and deployed to a different server/database. I have tried using a JOIN element, but it only joins on the primary key of the parent object which in this case is the Id. I need for it to join on the AssignedTo field.

I tried mapping an entity (brand new mapping file) for an employee, but it throws an error that the schema has too many prefixes (I put in the servername.category.schema.table).

Should I keep it as a separate method? It seems to be the easiest, but at the same time really redundant since all I need are a few fields from the employee table while at the same time requiring most of the information in the Request object.

**EDIT I am currently using NHibernate 2.0.1.4000. Thanks.


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.