-->
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: Problem with many to many mapping.
PostPosted: Mon Nov 27, 2006 10:13 am 
Newbie

Joined: Mon Oct 30, 2006 9:32 am
Posts: 5
Hi

I have a problem with creating C# objects and then mapping them for the following database structure:

TABLE "OBJECT"
ID (PK) Int;
NAME varchar(50);

TABLE "PROPERTY"
ID (PK) Int;
NAME varchar(50);

TABLE "VALUES"
OBJECT_ID(PK) int;
PROPERTY_ID(PK) Int;
VALUE string;

I have read NHibernate manuals, but all of the examples for many to many mapping are without value column in VALUES table.

I'm using NHibernate 1.2 Beta 2 if this is important.

Thanks for the help in advance.

_________________
Stephan Zahariev
http://szahariev.blogspot.com/


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 10:33 am 
Regular
Regular

Joined: Thu Nov 23, 2006 10:29 am
Posts: 106
Location: Belgium
Hi,

Actually, I don't see a many-to-many structure here. To me, it's a:
one-to-many from object to value
and a
one-to-many from property to value

'value' should be an object in itself an cannot act as a many-to-many relation. Instead, use 2 one-to-many's.
Which means there's no direct link between "object" and "property": if you want to know which properties are bound to "object", you'll have to enumerate the value-objects.

Please rate this post if it helped,
X


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 11:30 am 
Newbie

Joined: Mon Oct 30, 2006 9:32 am
Posts: 5
Thanks. I will give it a try.
Anyway, if someone knows better solution to the problem I will be glad to share it.

_________________
Stephan Zahariev
http://szahariev.blogspot.com/


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.