Thanks ! I'll try it. Sounds like a better solution than mine. Rotem
On Sep 10, 4:35 pm, Fabio Maulo <[email protected]> wrote: > You can write your custom insert/update/delete/load SQL queries in the > mapping. > Btw :http://fabiomaulo.blogspot.com/2009/06/database-eliot-ness-of-it.html > > 2009/9/10 Rotem Kirshenbaum <[email protected]> > > > > > > > > > Hi everyone, > > I have the following problem: > > I have a legacy DB in which I've mapped several tables to entities. At > > least one of the tables is mapped into different entities (each entity > > uses a different set of columns from the table). > > > When I try to save a new entity I get an ADOException because I try to > > perform an Insert where some columns cannot be null (they aren't even > > mapped to the entity). > > > I can't change the table structure - This might cause the legacy app > > to have problems (we are running both the legacy and new apps side by > > side). > > > I've found a temporary solution (a.k.a. ugly hack) - Instead of saving > > a new entity with NH, I perform a Sql Insert that adds a table row > > with default values and the Id of the entity. Afterwards I can get the > > empty entity using Session.Get, and perform updates as usual. > > > Anyone knows a better way to do this ? I know this is not an ideal > > situation, but I'm dealing with many legacy constraints here. > > > Thanks, > > Rotem > > -- > Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
