-->
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: Mixing annotations and mapping while using inheritence
PostPosted: Thu Oct 04, 2007 2:21 pm 
Newbie

Joined: Sat Jun 24, 2006 12:35 am
Posts: 5
I am new to annotations and would like to know if its possible to mix annotations with mappings while using inheritance strategies.

For (e.g) if I have a hbm mapping file say A.hbm.xml
Can I extend A and annotate it?

Specifically, can I do something like this:

@Entity
@Table(name="B")
@PrimaryKeyJoinColumn(name=B_id")
public class B extends A
{

@Column(name="newCol", nullable=true, length=50)
private String newCol;
...
}

class A does not have any annotations, just A.hbm

A.hbm:

<class name="com.my.object.A" >
...

<property name="name" column="name" ...>
</class>

Generally can I do something like this for any mapping strategy?

I read this line in the annotations docs and did not quiet understand:
"You cannot mix configuration strategies (hbm vs annotations) in a mapped entity hierarchy either"

Does this mean I cannot do what I am wanting to do?


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.