-->
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: Override parent class table mapping annotations
PostPosted: Fri Jul 09, 2010 2:18 pm 
Newbie

Joined: Fri Mar 19, 2010 7:00 pm
Posts: 14
Hello! I do not know if this is possible but I have two database tables (lets call them "parent" and "children") that have the same structure except that one "children" table has an extra field.

Now I can have two classes (Parent.java and Children.java) mapped to each of these tables that will contain the same fields and setter/getter methods except that Children will contain a extra property along with its setter/getter method OR what I was looking into doing was having Children.java EXTEND Parent.java but have the mapping annotations in Children.java map to the "children" table instead of the "parent" table. Is this possible?

Here is what Parent annotations look like:

Code:
@Entity
@Where(clause = "deleted_at IS NULL")
@Table(name = "parent")
@XmlType(name = "Parent", namespace = "http://model.myproject.com")
public class Parent implements Auditable {
....


here is what Children annotations I was hoping would look like with with the mapping to a different DB

Code:
@Entity
@Where(clause = "deleted_at IS NULL")
@Table(name = "children")
@XmlType(name = "Children", namespace = "http://model.myproject.com")
public class Children extends Parent {
....


I tried this code but it doesn't work because it's still being mapped to "parent" table and its complains that the extra property in Children could not be mapped or found.

Thanks!


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.