-->
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: Single Table Strategy Inheritance Question
PostPosted: Tue May 13, 2008 6:00 pm 
Newbie

Joined: Fri Mar 21, 2008 1:27 pm
Posts: 9
Location: Los Angeles, US
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.2

Mapping documents:
JPA Annotations

Code between sessionFactory.openSession() and session.close():
N/A

Full stack trace of any exception that occurs:
N/A

Name and version of the database you are using:
MySQL 5.0

The generated SQL (show_sql=true):
N/A

Debug level Hibernate log excerpt:
N/A

Problems with Session and transaction handling?
No

Read this: http://hibernate.org/42.html


Assuming the following classes, how can I convert a persisted BasicUser to an AdminUser?

Code:
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@Table(name = "user")
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.INTEGER)
public class User {
   //some mapped fields
}



Code:
@Entity
@DiscriminatorValue("1")
public class BasicUser extends User {
   //some mapped fields
}


Code:
@Entity
@DiscriminatorValue("2")
public class AdminUser extends User {
   //some mapped fields
}

_________________
if you find yourself in a hole, stop digging.


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.