no one is willing to address this, eh? must be too simple of a problem. but alas, it is not. the behavior I'm seeing is both inconsistent, and routinely unexpected given common sense.
for more context, please see: http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/da98598a7b60116d yes, i'm using Fluent for my mappings. yes, I can get you the HBM if you absolutely need it. yes, i'm confident that my problems are both a consequence of not mapping Fluent correctly, and also correct mappings resulting in unexpected NHib behavior. one such issue that does not seem to differ regardless of how I map my entities: -- Does NHib require me to add entities to the Session in the order in which they need to be saved to correctly reference a one-to-many/many-to-one association? For instance, if I have a Ticket instance which has mapped an IList<Note> ... I'm seeing that if I add 3 Note instances, which have valid Ticket instances references and valid Note.TicketID values, to the Session BEFORE adding the Note.Ticket instance, then BeginTransaction().Commit .. NHib fails on insert (Note.TicketID is an invalid FK, oracle error, as the TicketID column has a FK constraint). If I add the Ticket first, the save works, but the Note instances in the cache are not updated with the TicketID generated in Oracle. The database has correct values, but this means that if I Load<Ticket>(ticketID) again, Ticket.Notes(0).TicketID, for instance, is still 0 -- the value it had BEFORE the transaction was committed. Thanks for your help .... ------ Joe Brockhaus [email protected] ------------ On Wed, Feb 2, 2011 at 7:14 PM, fel0niousmonk <[email protected]> wrote: > background: > -- the database is Oracle. > -- PKs for both tables (TICKETS, NOTES) are generated by sequences > (SEQ_TICKET_ID, SEQ_NOTE_ID) > -- Silverlight & RIA Services > > question: > -- given the following, what should my mapping look like? > > public class Ticket > { > [Key] > public int TicketID {get;set;} > > [Include] > [Association("Ticket_Notes", > "TicketID", > "TicketID"] > public IList<Note> Notes = new List<Note>(); > } > public class Note > { > [Key] > public int NoteID {get;set;} > > [Include] > [Association("Note_Ticket", > "TicketID", > "TicketID", > IsForeignKey = true)] > public Ticket Ticket {get;set;} > public int TicketID {get;set;} > } -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
