[nhusers] Re: Discriminator bug

2008-09-28 Thread Stefan Nobis
Jon Palmer [EMAIL PROTECTED] writes: As I described in an earlier email, it's entirely right, indeed preferable, that NHibernate does not add the where clause when you query for the base class (as is always the case if there is only one class). It depends on your viewpoint. You are right

[nhusers] Re: Discriminator bug

2008-09-26 Thread Tuna Toksöz
] On Behalf Of Peter Lin Sent: Friday, September 26, 2008 11:29 AM To: nhusers Subject: [nhusers] Re: Discriminator bug the reason is simple. what if I'm reading data from an existing database, which uses the concept of a discriminator with address_type_code. what if the address table has entries

[nhusers] Re: Discriminator bug

2008-09-26 Thread Jon Palmer
Subject: [nhusers] Re: Discriminator bug just to clarify, what I am saying is this. when I have a single class that uses discriminator and no subclass, it generates a select statement like this select street1, street2, city, state_or_provide, postal_code from Address when I have subclass

[nhusers] Re: Discriminator bug

2008-09-26 Thread Peter Lin
I'll rephrase it another way. shouldn't the select statement always include address_type_code column, since it is the discriminator column? We've established the discriminator column isn't a property, but it needs to be included in the select statement so that polymorphic queries work

[nhusers] Re: Discriminator bug

2008-09-26 Thread Jon Palmer
-Original Message- From: nhusers@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Peter Lin Sent: Friday, September 26, 2008 12:19 PM To: nhusers Subject: [nhusers] Re: Discriminator bug I'll rephrase it another way. shouldn't the select statement always include address_type_code

[nhusers] Re: Discriminator bug

2008-09-26 Thread Peter Lin
that would be fine if the model was static, we didn't use a nice gui modeling tool and users weren't going to create subclasses. I respectfully disagree, since I feel it is more consistent to always include the discriminator column in the column list of the select statement. excluding it feel

[nhusers] Re: Discriminator bug

2008-09-26 Thread Ayende Rahien
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

[nhusers] Re: Discriminator bug

2008-09-26 Thread Peter Lin
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,

[nhusers] Re: Discriminator bug

2008-09-26 Thread Tuna Toksöz
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

[nhusers] Re: Discriminator bug

2008-09-26 Thread Ayende Rahien
No, the SF mapping is immutable On Fri, Sep 26, 2008 at 11: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

[nhusers] Re: Discriminator bug

2008-09-26 Thread Jon Palmer
the case if there is only one class). Jon -Original Message- From: nhusers@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Peter Lin Sent: Friday, September 26, 2008 12:37 PM To: nhusers Subject: [nhusers] Re: Discriminator bug sorry for the confusing explanations. I'll attempt

[nhusers] Re: Discriminator bug

2008-09-26 Thread Ayende Rahien
PM To: nhusers Subject: [nhusers] Re: Discriminator bug 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

[nhusers] Re: Discriminator bug

2008-09-26 Thread Tuna Toksöz
the case if there is only one class). Jon -Original Message- From: nhusers@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Peter Lin Sent: Friday, September 26, 2008 12:37 PM To: nhusers Subject: [nhusers] Re: Discriminator bug sorry for the confusing explanations. I'll

[nhusers] Re: Discriminator bug

2008-09-26 Thread Fabio Maulo
If you are working on existing table that represent more than one class state and you want work with NH as normal, NH must know it.NH must know how many classes you have in the table or... Use the where clause when you have only one class, then, when somebody add a plug-in change the mapping

[nhusers] Re: Discriminator bug

2008-09-26 Thread Jon Palmer
BaseAddress or HomeAddress, pick their discriminator value and you're good to go. Jon From: nhusers@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tuna Toksöz Sent: Friday, September 26, 2008 1:55 PM To: nhusers@googlegroups.com Subject: [nhusers] Re: Discriminator bug What