ok, if no one can answer, can someone point me in the direction of the
hard-to-find documentation for BASIC inheritance mapping?

------
Joe Brockhaus
[email protected]
------


On Mon, Jan 24, 2011 at 7:29 PM, Joe Brockhaus <[email protected]> wrote:

> I should add this is obviously not how i would like to have
> architechted the database
>
> On 1/24/11, Joe Brockhaus <[email protected]> wrote:
> > for my 'easy' example, it would seem as though table-per-class is what i
> > need.
> >
> > How does one map that, Fluently? Documentation on this is lacking, afaik.
> >
> > The Hibernate doc for table-per-concrete, suggests that one can use
> > abstract
> > classes.
> > (
> http://docs.jboss.org/hibernate/core/3.5/reference/en/html/inheritance.html
> > )
> >
> > Does anyone know if that Is that ONLY for that metaphor? If not, am I
> > limited to *not *using abstract in TPC?
> >
> > Thanks
> >
> > ------
> > Joe Brockhaus
> > [email protected]
> > ------
> >
> >
> > On Mon, Jan 24, 2011 at 1:36 PM, Joe Brockhaus <[email protected]>
> wrote:
> >
> >> OK, then I suppose ignore the abstract requirement (just trying to
> >> maintain
> >> best practices in the code. wouldn't want a dev trying to new up a base
> >> class which can't live on its own..)
> >>
> >> assuming a basic inheritance example:
> >>
> >> domain:
> >>
> >> public class EntityBase
> >> {
> >>     public virtual string ID {get;set;}
> >>     public virtual DateTime CreateDate {get;set;}
> >>
> >>     public virtual string Type {get;}
> >>     public virtual string SubTypeType {get;} // was abstract to force
> >> override in children..
> >>     ...
> >> }
> >> public class EntityChildA : EntityBase
> >> {
> >>     public string ACustomProperty {get;set;}
> >>     public override string SubTypeType {get {return "ECA";} }
> >> }
> >>  public class EntityChildB : EntityBase
> >> {
> >>     public string BCustomProperty {get;set;}
> >>     public override string SubTypeType {get {return "ECB";} }
> >> }
> >>
> >>
> >> table (1):
> >>
> >> |   ID     |   SubTypeType   |   CreateDate   |   ACustomProperty   |
> >> BCustomProperty   |
> >>
> >>
> >>
> >>
> >>
> ----------------------------------------------------------------------------------------------
> >>
> >> now, as for explaining my original question of crazy schema ...
> >>
> >> there are other existing tables which are also the same 'type' as these
> >> entities.
> >> (This is why it's SubTypeType above..)
> >>
> >> perhaps trying to map this schema is not something i should try to do,
> >> and
> >> interface the 1,2,3 types to perform common actions across them.
> >>
> >> But that means I still need to know how to map the first, 'easy',
> >> scenario.
> >>
> >> so the thinking would be:
> >>
> >> tables (3, in this ex) might look like:
> >>
> >>  |   ID     |   Type   |   SubTypeType   |   CreateDate   |   1AProperty
> >> |
> >> |   ID     |   Type   |   SubTypeType   |   CreateDate   |   2AProperty
> >> |
> >>  |   ID     |   Type   |   SubTypeType   |   CreateDate   |
> >> 3ACustomProperty   |    3BCustomProperty   |
> >>
> >> which might represent 4 (child) types:
> >>
> >>  public class EntityBase
> >> {
> >>     public virtual string ID {get;set;}
> >>     public virtual DateTime CreateDate {get;set;}
> >>
> >>     public virtual string Type {get;}
> >>     public virtual string SubTypeType {get;} // was abstract to force
> >> override in children..
> >>     ...
> >> }public class EntityChild1A : EntityBase
> >>  {
> >>     public string 1AProperty {get;set;}
> >>     public override string Type {get {return "1A";} }
> >>     public override string SubTypeType {get {return "A";} }
> >> }
> >> public class EntityChild2A : EntityBase
> >> {
> >>     public string 2AProperty {get;set;}
> >>     public override string Type {get {return "2A";} }
> >>     public override string SubTypeType {get {return "A";} }
> >> }
> >> public class EntityChild3A : EntityBase
> >> {
> >>     public string 3ACustomProperty {get;set;}
> >>      public override string Type {get {return "3A";} }
> >>     public override string SubTypeType {get {return "A";} }
> >> }
> >> public class EntityChild3B : EntityBase
> >> {
> >>     public string 3BCustomProperty {get;set;}
> >>     public override string Type {get {return "3B";} }
> >>     public override string SubTypeType {get {return "B";} }
> >> }
> >>
> >> Thanks =)
> >>
> >> ------
> >> Joe Brockhaus
> >> [email protected]
> >> ------
> >>
> >
>
>
> --
>  ------
> Joe Brockhaus
> [email protected]
> ------
>

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en.

Reply via email to