[hibernate-dev] overriding target through annotations

Max Rydahl Andersen max.andersen at jboss.com
Thu Nov 30 01:51:13 EST 2006


this would help on a related issue  
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2268 which
is about the problem of redundant methods in jdk5 when you have covariant  
methods (e.g. Object clone() in Object and Customer clone() in Customer)

With respect to HHH-2268 we could also filter out the bridge methods (by  
checking if they are volatile or not), but wouldn't that prevent users
 from being able to annotate the covariant methods ?...or is the  
annotations available on both methods...i guess it needs testing.

/max

> I'm looking at ANN-422
>
> In HA, the target is usually inferred from the API (generics), and can  
> be overridden in all associations through targetEntity (  
> @ManyToOne(targetEntity...) )
> currently, you cannot override the target for a component, nor you can  
> override it for a <map-key-many-to-many/>
>
> Two solutions
>
> 1.
> Define a @Target annotation that will work like the targetEntity for  
> association and also handle components (@Embedded)
> Define a @MapKeyTarget to override the <map-key-many-to-many/> or  
> <map-key/> (composite-element) target
>
> 2.
> Define a @Target annotation that will work like the targetEntity for  
> association and also handle components (@Embedded)
> add a targetElement to @MapKey and @MapKeyManyToMany annotations
>
> I don't like much 2 because it mixes physical concerns and logical ones,  
> but it reduce the amount of needed annotations
>
> Note that I hope the future spec will hopefully handle all cases nicely  
> (ie add a targetElement in @Embedded), @MapKey should go to back the  
> drawing board from a spec POV so we can think of something clean from  
> the begining.
>
> Any preference, or alternative solution?
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev



-- 
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
max at hibernate.org
http://hibernate.org

JBoss a division of Red Hat
max.andersen at jboss.com



More information about the hibernate-dev mailing list