I have in herited a legacy database that doesn't have foreign keys on these 2 tables, and therefore not surprisingly, no join table.
If I'm not misataken creating a join table now is impossible since I can't create a foreign key on either of these tables, because both table have many records per BookingIds. Or am I wrong somehow?
BookingsTable ID - primarykey BookingId (this is what I need to join on) BookingLocationsTable ID - primaryKey BookingId (this is how I would join)
I would like to create a many to many relationship between these to tables in fluent nHibernate.
Es esto imposible?
Would I better off trying do a simple query with a join?
If so I might need to abandon hibernate / nhibernate at all because the these tables are vital to the domain, and perhaps there will be more examples of this.
Or perhaps I need to restructure the database / tables some how to use nHibernate?
preguntado el 01 de febrero de 12 a las 14:02
After some reflection and discussion, I realise that there is actually no salvagable relationship between these 2 tables.
I am new to this type of ORM so had assumed that I needed some sort of relationship between the tables to do the equivalent of a join.
After some research I have found that I can use linq to nHibernate, HQL, or even db native SQL to do what I need to do.
Upward an onward :)