Project

General

Profile

Actions

Support #697

closed

Represent extra attributes in many-to-many relation in Dbo

Added by omair geetan over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
01/22/2011
Due date:
% Done:

0%

Estimated time:

Description

How do i add extra attributes on many-to-many relation in Dbo.

for example: how do i represent this relation

Student(student_id,student_name,...)

Grade(grade_id,grade_name,...)

StudyYear(study_year_id,study_year_name,...)

StudentGradeRel(student_id,grade_id,study_year_id,student_number,offDays,...)

Actions #1

Updated by Koen Deforche over 13 years ago

Hey,

That is indeed not possible using a Many-to-Many relation.

In this case you will need to explicitly model the link table using two Many-to-One relations ?

Regards,

koen

Actions #2

Updated by omair geetan over 13 years ago

you mean for example:

Student 1:M StudentGradeRel

Grade 1:M StudentGradeRel

StudyYear 1:M StudentGradeRel

i know it can be done like that,

but how do i perform this query (in Dbo not in Sql)

all students in grade X and StudyYear Y,

Actions #3

Updated by Koen Deforche over 13 years ago

  • Status changed from New to Resolved

Hey,

You really should use SQL for that query:

Students students = session.query< dbo::ptr<Student> >("select s from Student join StudentGradeRel r on s.student_id = r.gradien_id ...").where("...");

Regards,

koen

Actions #4

Updated by Koen Deforche over 13 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF