[hibernate-dev] overriding target through annotations

2006-11-29 Thread Emmanuel Bernard

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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


Re: [hibernate-dev] overriding target through annotations

2006-11-29 Thread Max Rydahl Andersen


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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev




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

Hibernate
[EMAIL PROTECTED]
http://hibernate.org

JBoss a division of Red Hat
[EMAIL PROTECTED]
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev