What is your intention regarding the students.teacher object?

-------------------------------------
YING-KWANG TU<ying.kwang...@gmail.com> wrote:

Neil,

In a nutshell... assuming teacher is the main entity and student is another
entity. You will need to:

In your "teachers" class:

   1. extend "with ManyToMany" trait
   2. declare a "students" object of type "MappedManyToMany(teacher_student,
   teacher_student.teacher_id, teacher_student.student_id, students)"

In your "students" class:

   1. declare a "teacher" object of type "MappedLongForeignKey(this, Role)"

In your "teacher_student" class:

   1. declare a "teacher_id" object of type "MappedLongForeignKey(this,
   teachers)"
   2. declare a "student_id" object of type "MappedLongForeignKey(this,
   students)"

*Note: the names are according to your convention.

Yours,
  yk

On Mon, Oct 26, 2009 at 12:29 PM, YING-KWANG TU <ying.kwang...@gmail.com>wrote:

> Neil,
>
> The following thread has very good information on many-to-many
> implementation:
>
> http://groups.google.com.my/group/liftweb/browse_thread/thread/5793917fee419f89
>
> I can't summarize it for you but the thread above do give you some
> pointers.
>
> Cheers,
>   yk
>
>
> On Mon, Oct 26, 2009 at 11:52 AM, Neil.Lv <anim...@gmail.com> wrote:
>
>>
>> Hi all,
>>
>>  Dose anybody know that how to use the many-to-many relationship in
>> the lift model ?
>>
>>  * We need to create a 3 models to represent the 3 tables ( teachers,
>> students, teacher_student )
>>    ex:
>>    teachers  ->  id, name, sex, age, ...
>>    students ->   id, name, sex, age, ...
>>    teacher_student -> id, student_id, teacher_id
>>
>>  * How to write the code in the model to represent this
>> relationship ?
>>
>>  Or any other ways that can achieve this purpose ?
>>
>>  Thanks for any suggestion !
>>
>> Cheers,
>>  Neil
>>
>> >>
>>
>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to