-->
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: Mapping a whole table (therefore without foreign-key)
PostPosted: Wed Feb 14, 2007 7:53 am 
Newbie

Joined: Wed Feb 14, 2007 7:42 am
Posts: 3
Location: London, UK
Hi,

I'm stuck with a problem, and I can't find any solution on the internet.

I have a class A, and I would like to map every object of class B (the whole B table then) on a IDictionnay on class A.

The problem is when you try to use the <map> structure, you have to give a <key> which doesn't exist :

so we have a class A:

Code:
public class A_Class
{
   IDictionnary<string, B_Class> MyBees;
}


and a class B:

Code:
public class B_Class
{
  string Name;
}


So basically, I want every B (all rows in the B table if you prefer) in the dictionnay in class A.

Code:
      <map name="MyBees" table="B_Table">
        <key column="THIS COLUMN DOESN'T EXIST"></key>
        <index column="Name" type="string"></index>
        <one-to-many class="B_Class"/>
      </map>


How can I achieve that?

Many thanks for your answers,

Antoine.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 12:15 pm 
Newbie

Joined: Tue Oct 24, 2006 2:51 pm
Posts: 19
This is not a standard form of relational algebra, you are trying to usa a 1:M (one to many) relation to archieve a "One to Entire Table" relation, that is something Nhibernate i think just doesn't account for

You can solve using some fields in the DB with default values set, but sincerly i don't know if this would be a needed feature of NHibernate ORM Layer.

Greetzz


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 15, 2007 7:15 am 
Newbie

Joined: Wed Feb 14, 2007 7:42 am
Posts: 3
Location: London, UK
darXstar wrote:
This is not a standard form of relational algebra, you are trying to usa a 1:M (one to many) relation to archieve a "One to Entire Table" relation, that is something Nhibernate i think just doesn't account for

You can solve using some fields in the DB with default values set, but sincerly i don't know if this would be a needed feature of NHibernate ORM Layer.

Greetzz


Thanks, that's what I thought anyway :(

I will try to find another way :)

Thanks a lot,

Antoine


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.