-->
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.  [ 4 posts ] 
Author Message
 Post subject: how to define annotation for interface implementation_
PostPosted: Mon Mar 13, 2006 6:30 pm 
Newbie

Joined: Mon Mar 13, 2006 6:15 pm
Posts: 2
hi,
i use ejb3.0,and I have some classes:
Code:
Interface Item{...}
Class  ItemImplA implements Item{...}
Class  ItemImplB implements Item{...}
@Entity
Class Order{
   
[color=red]Item item;[/color]

    ...
}

so now i don't know how to write annotation for item.
i think @TargetEntity can only use for one class.but now i have 2 classes implements Item.What can I do? Is an interface-reference supported?
thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 25, 2006 8:23 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
An interface pointing to 2 different mapped class implementations is not supported currently

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 10:26 am 
Newbie

Joined: Tue Apr 25, 2006 10:01 am
Posts: 1
is there a way to annotate an interface with only one implementing class?
I have an interface Item and just one implementing class ItemImpl. Can I annotate Item pointing to ItemImpl?
I didn't find anything in the Hibernate Annotations Reference concerning Interfaces and how to map them...

Thanks for your help.
Did


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 10:35 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
what you should do is annotate the implementation
and use the following construct
@ManyToOne(targetEntity=MyServiceImpl.class)
MyService getMyService()

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.