A row in the DB is the representation of the state of one object: which one?

--
Fabio Maulo


El 22/10/2010, a las 11:40, Brian Chavez <[email protected]> escribió:

> Hi Alan,
>
> Thanks so much for the reply. I'm trying to avoid NHibernate using the
> database to determine the type of object.
>
> A single row in Table 1 can be projected into any object in the class
> hierarchy.
>
> For example, Row 5 is A, B, or C; depending on which type I'm
> requesting.
>
> If I CreateCriteria(typeof(C)), then NHibernate has enough information
> to know what type I'm requesting.
>
> I don't want NHibernate to extract type information from the database
> (ie: discriminator) because class A, B, and C can all represent any
> row in Table 1.
>
> The only difference between A, B, and C classes is the projections of
> the columns in the table.
>
> I hope that clarifies my situation.
>
> Any feedback would be appreciated!
> -Brian
>
>
> On Oct 22, 7:13 am, "[email protected]"
> <[email protected]> wrote:
>> You can use formulas as discriminators as opposed to a column.  You
>> obviously have some sort of logic that determines the object type?
>>
>> On Oct 22, 9:02 am, Brian Chavez <[email protected]> wrote:
>>
>>
>>
>>> Hello.
>>
>>> Problem:
>>
>>> I have 1 very large table of columns.
>>
>>> I have a class hierarchy that represents different projections of the
>>> columns of this table.
>>
>>> For example:
>>
>>> class A{
>>>    AProperty{get;set;} //Mapped to ColumnA in Table 1
>>
>>> }
>>
>>> class B : A {
>>>     BProperty{get;set;} //Mapped to ColumnB in Table 1
>>
>>> }
>>
>>> class C : B {
>>>     CProperty{get;set;}
>>
>>> }
>>
>>> When I ask NHibernate to pull C, I expect to see C.AProperty,
>>> C.BProperty, and C.CProperty.
>>
>>> Essentially, this class hierarchy represents different scoped
>>> projected views of the *same* table.
>>
>>> How do I do this in hbm.xml mapping files without adding discriminator
>>> values?
>>
>>> I've tried to use multiple <union-subclass> attributes and map to the
>>> same table, but NH throws an exception:
>>
>>> --> NHibernate.DuplicateMappingException : Duplicate table mapping
>>> Table 1
>>
>>> Any ideas?
>>
>>> Thanks,
>>> Brian
>
> --
> 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.
>

-- 
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.

Reply via email to