Hmm, right. On Fri, Sep 26, 2008 at 11:44 PM, Peter Lin <[EMAIL PROTECTED]> wrote:
> > > what if I have an assembly which has a core domain objects and users > create custom extensions with subclasses in a separate assembly? > > I'll re-iterate. I'm happy to provide a patch if someone points me to > the right file. > > peter > > > On Sep 26, 4:37 pm, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote: > > So my question is can we add new mappings for classes after the session > > factory is initialized?If yes, you are very correct, if not, you can > always > > change mapping. > > > > > > > > On Fri, Sep 26, 2008 at 11:35 PM, Peter Lin <[EMAIL PROTECTED]> wrote: > > > > > for those who haven't read the latest edition of hibernate book by > > > gavin. from chapter 13 page 584, he provides an example of a query > > > generated by hibernate for classes that use discriminator > > > > > select > > > b1.BILLING_DETAILS_ID, > > > b1.OWNER, > > > b1.USER_ID, > > > b2.ACCOUNT, > > > b2.BANKNAME, > > > b2.SWIFT, > > > b1.BILLING_DETAILS_TYPE as clazz > > > from > > > BILLING_DETAILS b1 > > > > > In gavin's example, BILLINGS_DETAILS_TYPE is the discriminator > > > column. In order for polymorphic queries to work properly in > > > Hibernate and NHibernate, it looks at billings details type and then > > > determines which class to instantiate. Even though my use case doesn't > > > have a subclass at the present, there will be subclasses eventually. > > > Logically, the select statement for all discriminated classes need to > > > include the discriminator column. Other clearly disagree, or have a > > > different understanding of how polymorphic queries should work. Having > > > worked on and used other ORM tools, the approach used by other tools > > > is to always include the discriminator column. > > > > > peter > > > > > On Sep 26, 3:38 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote: > > > > Using a where="" is the appropriate action here, not a discriminator. > > > > > > On Fri, Sep 26, 2008 at 10:36 PM, Peter Lin <[EMAIL PROTECTED]> > wrote: > > > > > > > sorry for the confusing explanations. I'll attempt to explain it > > > > > better. > > > > > > > Here is the situation. > > > > > > > I. I have a table in a legacy database which has existing records > > > > > which use the concept of a discriminator. In other words, there is > a > > > > > type_code column, which has different values. > > > > > > > II. I have a C# object which represents an entity. The entity maps > to > > > > > records in the table with a specific discriminator value. > > > > > > > III. I only want to get the records with a specific discriminator > > > > > value from the table like "home_address". > > > > > > > IV. I have a modeling tool which generates C# classes with the > > > > > appropriate NH attributes. Changing the code gen for the special > case > > > > > to use one of the work arounds feels like a hack to me. > > > > > > > V. since polymorphic queries require the discriminator column to > > > > > create the correct object instance, shouldn't it always include it > in > > > > > the select part of the sql statement? > > > > > > > thanks for taking time to listen and respond. > > > > > > > peter > > > > > > > On Sep 26, 3:20 pm, "Jon Palmer" <[EMAIL PROTECTED]> > wrote: > > > > > > If you have only one class mapped then the only thing it can > return > > > is > > > > > > that one class so why would it need the address_type_code column? > > > > > > > > One of your previous emails indicated the problem was returning > all > > > rows > > > > > > from the table. I'm confused about what the problem is your > tryign to > > > > > > solve. > > > > > > > > Jon > > > > -- > > Tuna Toksöz > > > > Typos included to enhance the readers attention! > > > -- Tuna Toksöz Typos included to enhance the readers attention! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
