Project

General

Profile

Actions

Support #697

closed
OG

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

Support #697: Represent extra attributes in many-to-many relation in Dbo

Added by omair geetan over 15 years ago. Updated over 15 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,...)

KD Updated by Koen Deforche over 15 years ago Actions #1

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

OG Updated by omair geetan over 15 years ago Actions #2

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,

KD Updated by Koen Deforche over 15 years ago Actions #3

  • 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

KD Updated by Koen Deforche over 15 years ago Actions #4

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom