Project

General

Profile

How to map 2 tables to same class?

Added by Rathnadhar K V over 8 years ago

Namasthe

I have a class Student{}

I want to map this class to 2 tables,

student_tbl

student_mirror_tbl

that means both stdent_tbl and student_mirror_tbl have exactly same table structure. There are no foreign keys in either of the tables.

How can I do that using mapclass??

Regards

Rathnadhar.K.V


Replies (3)

RE: How to map 2 tables to same class? - Added by Rathnadhar K V over 8 years ago

is it possible??

or

Should I create a dummy class (student_mirror) that just inherits the base class(students) and then create a mapclass...this is not a very elegant solution....IMHO

Regards

Rathna

RE: How to map 2 tables to same class? - Added by Koen Deforche about 8 years ago

No you can't do that. Allowing this would open up a number of questions, like:

  auto s = session.add(new Student());

Does this add a 'student_tbl' record or a 'student_mirror_tbl' record?

    (1-3/3)