This content has been marked as final.
Show 3 replies
-
1. Re: Mixing annotations and hbm.xml
jc7442 Aug 26, 2005 9:46 AM (in response to jc7442)Sorry, I rewriite the post, I made a mistake !!!
"jc7442" wrote:
Is it possible to mix for the same entity bean annotations and hbm.xml ?
In my application I have an interface Animal and several subclasses (Dog, Cat, ...). Since it seems that annotations to declare interface and subclasses are not supported (specified ??) in EJB3 (http://forum.hibernate.org/viewtopic.php?p=2238824#2238824), I'd like to declare in hbm.xml only the annotaions for the interface and to declare other fields of subclasses using ejb3 annotation:public interface Pet { int getId(); void setId(int id); } @Entity() public class Dog { ... @ManyToOne public void getChildren() { ...} <hibernate-mapping> <class name="Pet" table="Pet" lazy="false"> <id name="id" column="PET_ID"> <generator class="native" /> </id> <joined-subclass name="Dog" extends="Pet" lazy="false"> <key column="PET_ID" /> </joined-subclass> </class> </hibernate-mapping>
If I writte that kinds of things, I have an exception due to a duplicate declaration for my class Dog.
A lot of class inherits from my interface and I'd preferred to use annotation instead of hbm.xml files. Is there a way to mix for the same entity hbm.xml and annotations ? -
2. Re: Mixing annotations and hbm.xml
bill.burke Aug 26, 2005 9:58 AM (in response to jc7442)no support for XML overrides yet, but you can specify one bean in XML the other in annotations and set up a relationship between the two...
-
3. Re: Mixing annotations and hbm.xml
epbernard Sep 1, 2005 6:40 AM (in response to jc7442)you can't mix a hierarchy so far. It's a hard one to do.