These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Mappiing a table and have it inheriting from a super class
PostPosted: Tue Sep 01, 2009 2:25 pm 
Newbie

Joined: Tue Sep 01, 2009 2:21 pm
Posts: 1
Hi all.

I have the Following problem:

I got an entity (let's call it "worker" for the example) which belongs
to another app. From here I want to retrieve some info, and since I
don't want to be always syncronizing, i would like to be fetching info
from here.

I can access it with the following line and all the necessaries
mappings:

Code:
    [ActiveRecord("Worker",  Schema = "HumanResources.dbo",
SchemaAction = "none", Mutable = false)]
    public partial class Worker: ActiveRecordBase
    {
        [PrimaryKey(PrimaryKeyType.Native, "COD", ColumnType =
"Int32")]
        public int Id { get; set; }

        [Property("NOME", ColumnType = "String", NotNull = true)]
        public virtual string Name { get; set; }

        [Property("SEXO", ColumnType = "String", NotNull = true)]
        public virtual string Sex { get; set; }

        internal static IEnumerable<Worker> FindAll()
        {
            IEnumerable<Worker> aux = null;

            try
            {
                aux = (IEnumerable<Worker>) ActiveRecordBase.FindAll
(typeof (Worker));
            }
            catch(Exception _ex)
            {
                MessageBox.Show(_ex.Message, "Worker Fetch Warning");
            }
            return aux;
        }
    }

My developing app is in another schema, so I specify it.

Now I want to be able to make it inherit from a class (call it it
SuperEntity), from which another class (Guest) inherits too.

I would have the following diagram:

SuperEntity
^ ^
| |
Worker Guest

How can I do my mapping? I have been trying several approaches, but
the one I think should be the most correct would be "table per
concrete subclass"... but i am not skilled yet to do it.

Tk

Just one PS: SuperEntity may not be represented in db, although I want
to be able to call all entry's of worker and guest by doing something
like SuperEntity.FindAll().


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.