-->
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.  [ 2 posts ] 
Author Message
 Post subject: DB inheritance mapping
PostPosted: Mon Nov 03, 2008 2:18 pm 
Newbie

Joined: Mon Nov 03, 2008 2:05 pm
Posts: 1
Hi,

I have a hierarchy similar to the following:

Code:
abstract class Person {
    private String firstname;
    private String lastname;
    //getters & setters
}

class User extends Person {
    private String username;
    private String password;
    //getters & setters
}

class Visitor extends Person {
    private Date visitDate;
    //getters & setters
}


As you can see, I don't want to be possible to make an instance of a Person, but only Users and Visitors.

How can I map this into entites that can perform CRUD actions? And, how the actual tables in the DB would look like?

Thanks in advance,

IP


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 03, 2008 2:24 pm 
Beginner
Beginner

Joined: Wed Sep 24, 2008 5:44 pm
Posts: 34
I'll link this page again :)

http://www.hibernate.org/hib_docs/refer ... tance.html


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

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.