Sorry but to create a mapping i must know, at least, 2 things: the class and how you want represent its persistent state.As you know, given a class graph you can represent its persistent state in various ways.
2009/2/20 Piotr Jakóbczyk <[email protected]> > > I can't send a actual classes and tables, but try to consider simple > example: > > abstract class BusinessObject > { > > } > > class ConcreteObject1 : BusinessObject > { > } > > class ConcreteObject2 : BusinessObject > { > } > > > On 20 Lut, 16:26, Fabio Maulo <[email protected]> wrote: > > Ok.Please send classes and tables, then we can talk about mappings. > > > > 2009/2/20 Piotr Jakóbczyk <[email protected]> > > > > > > > > > > > > > Yes, I know syntax of "mixing table per class hierarchy with table per > > > subclass". > > > But I require one SHALLOW (used as read-onlu) hierarchy used <union- > > > subclass> and several distinct hierarchy used "mixing table per class > > > hierarchy with table per subclass" with base db tables from first one > > > hierarchy. > > > > > On 20 Lut, 15:57, Fabio Maulo <[email protected]> wrote: > > > > The strategy "mixing table per class hierarchy with table per > subclass" > > > is a > > > > special and specific feature of Hibernate and NHibernate.The > > > implementation > > > > is > > > > <class> > > > > <discriminator ..../> > > > > <subclass> > > > > <join> > > > > </join> > > > > </subclass> > > > > <subclass> > > > > <join> > > > > </join> > > > > </subclass> > > > > </class> > > > > > > Reference here: > > >http://nhforge.org/doc/nh/en/index.html#inheritance-tablepersubclass-. > .. > > > > > > 2009/2/20 Piotr Jakóbczyk <[email protected]> > > > > > > > Thanks for quick response. > > > > > Let my explain in details what kind of mappings I need. > > > > > > > We have composed hierarchy of objects with common base abstract > class > > > > > - BusinessObject. Until now we have whole hierarchy mapped by > <joined- > > > > > subclass>. But becouse of performance reasons and specificity of > > > > > realized queries we want to horizontally divide base table of our > > > > > hierarchy into a few distinct tables: TABLE1, TABLE2, TABLE3. > > > > > > > The idea is following: > > > > > For every new distinct tables should be prepared new classes: > > > > > Class1Marker, Class2Marker, Class3Marker derivated from > BusinessObject > > > > > class. > > > > > Class1Marker, Class2Marker and Class3Marker classes are mapped by > > > > > <union-subcless>. > > > > > > > In this way, we will have SHALLOW hierarchy of object derivated > from > > > > > BusinessObject class (stored in several tables: TABLE1, TABLE2, > > > > > TABLE3). > > > > > This hierarchy is sufficient for most of required and frequently > > > > > executed queries and will be used for read only. > > > > > > > But any of Class1Marker, Class2Marker, Class3Marker classes does > not > > > > > represent concrete object. > > > > > So we want to prepare additional distinct hierarhies beased of a > > > > > tables TABLE1, TABLE2, TABLE3. For each table separated hierarchy > may > > > > > used different inheritance strategy (mixing table per class > hierarchy > > > > > with table per subclass). To do this we need to prepare another > > > > > mappings for tables TABLE1, TABLE2, TABLE3 and classes Class1, > Class2, > > > > > Class3 (not marker). > > > > > > > Everything works fine untill mappings of BusinessObject and > > > > > Class1Marker, Class2Marker, Class3Marker classes are placed before > > > > > other mapping for tables TABLE1, TABLE2, TABLE3. > > > > > > > On 20 Lut, 14:55, Fabio Maulo <[email protected]> wrote: > > > > > > You CAN'T use <union-subclass> mapping more than one class to the > > > same > > > > > > table. > > > > > > If you want use only one table you must use <subclass> or a trick > > > like > > > > > thishttp://fabiomaulo.blogspot.com/2008/10/power-of-orm.html > > > > > > > > 2009/2/20 Piotr Jakóbczyk <[email protected]> > > > > > > > > > I know what union-subclass is and I read references about all > > > > > > > inheritance strategy implemented by NH. > > > > > > > In my example I used <union-subclass> (look at SubclassA entity > > > > > > > mapping). > > > > > > > But why, in my example, the changing of the order of mapping > > > > > > > definitions provide different behevoiur of NH. The first order > > > raises > > > > > > > exception, but the second not. > > > > > > > > > On 20 Lut, 13:45, Fabio Maulo <[email protected]> wrote: > > > > > > > > union-subclass is an advanced way provided by NH to implement > the > > > > > mapping > > > > > > > > pattern : table-per-concrete-class > > > > > > > > What you are looking for is the implementation of the pattern > : > > > > > > > > table-per-class-hierarchy > > > > > > > > The tag for that is <subclass>; reference available > herehttp:// > > > > > > > nhforge.org/doc/nh/en/index.html#mapping-declaration-subclass > > > > > > > > > > -- > > > > > > > > Fabio Maulo > > > > > > > > > -- > > > > > > > Piotr Jakóbczyk > > > > > > > > -- > > > > > > Fabio Maulo > > > > > > > -- > > > > > Piotr Jakóbczyk > > > > > > -- > > > > Fabio Maulo > > > > > -- > > > Piotr Jakóbczyk > > > > -- > > Fabio Maulo > > > -- 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 -~----------~----~----~----~------~----~------~--~---
