-->
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.  [ 5 posts ] 
Author Message
 Post subject: many to many addition property on link table
PostPosted: Wed Apr 26, 2006 11:25 am 
Newbie

Joined: Wed Apr 05, 2006 1:32 am
Posts: 3
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 1.0.2

Name and version of the database you are using: SQL Server 2000

Hi all,

I am using NHIbernate for sometime. But I have a question, may be rather trivial.

I have a table "person" and table "rights"
there is a many to many relationship between the 2 tables.

I got this part on NHIbernate to work but how could I add a property on the link table

say the link table at the moment is

table(personId, rightId )

I wish to add a property called "isAdmin" making the table definition

table(personId, rightId, isAdmin)

how do I achieve that
??
and how does the nhibernate mapping go for it ??


Top
 Profile  
 
 Post subject: U cant perform the DDL operation with Hibernate.
PostPosted: Wed Apr 26, 2006 11:29 am 
Beginner
Beginner

Joined: Mon Mar 27, 2006 5:25 am
Posts: 39
Location: India Hyderabad
Hi Friend,

By using hibernate U cant perform the DDL operations like create alter tables.
Bcz that will be done once.
So it is not possible other than insert, update and delete.

-------------------------------------------
dont forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 11:32 am 
Newbie

Joined: Wed Apr 05, 2006 1:32 am
Posts: 3
Thanks For you prompt reply.

I think I might have confused you with my question. The question is not how to put a create table.

I already have these tables created but in many to many mapping how do I add an extra column along with the 2 id columns and how do I map it into my objects ?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 12:10 pm 
Regular
Regular

Joined: Tue Mar 15, 2005 12:38 pm
Posts: 73
Location: Bucharest
You can try a bag of components that has a bool (isAdmin) and a many-to-many...Otherwise map the link table as a distinct entity...

Anyhow, you can't still use a list/set of right objects from the person...some intermediate class must be created...

_________________
Dragos


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 12:14 pm 
Newbie

Joined: Wed Apr 05, 2006 1:32 am
Posts: 3
ok..
thanks for the clarification.
I thought of this but just wanted to make sure that I was not ignoring some feature.

Thanks A lot.
Pritesh


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.