[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4833) Honor targetEntity and targetClass from @XToX and @ElementCollection when populating the metamodel?

Steve Ebersole (JIRA) noreply at atlassian.com
Fri Jan 22 14:12:29 EST 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35310#action_35310 ] 

Steve Ebersole commented on HHH-4833:
-------------------------------------

Per your request:
{code}
[2010-01-22 12:56] <epbernard> sebersole: on HEM attribute factory. PluralAttributeMetadataImpl and SingularAttributeMetadataImpl do no honor targetElement (like in @OneToMany(targetElement=MyEntity.class) )
[2010-01-22 12:56] <epbernard> you basically get the type of the Java type system
[2010-01-22 12:56] <sebersole> epbernard, for associations ok thats wrong
[2010-01-22 12:56] <epbernard> Is there a reason why you did not take it from the Hibernate metamodel?
[2010-01-22 12:56] <sebersole> what we had before was wrong though for value types
[2010-01-22 12:57] <sebersole> yes ^^
[2010-01-22 12:57] <epbernard> ah ok
[2010-01-22 12:57] <sebersole> Dates
[2010-01-22 12:57] <sebersole> remeber
[2010-01-22 12:57] <epbernard> vaguely but yes
[2010-01-22 12:57] <sebersole> pretty sure we talked about that
[2010-01-22 12:57] <sebersole> ok
[2010-01-22 12:57] <epbernard> I am wondering
[2010-01-22 12:57] <epbernard> if the user does use raw types for it's model
[2010-01-22 12:57] <sebersole> so the metamodel (Type) always reports java.util.Date
[2010-01-22 12:58] <epbernard> should the metamodel try and correct that?
[2010-01-22 12:58] <epbernard> I mean replace with targetElement
[2010-01-22 12:58] <epbernard> I will make sure it does not break at least
[2010-01-22 12:58] <epbernard> but I am wondering if that's something we want to support actually
[2010-01-22 12:58] <sebersole> i dont grok all the implications of that
[2010-01-22 12:58] <sebersole> support which?
[2010-01-22 12:59] <epbernard> Should the metamodel reflects the targetElement
[2010-01-22 12:59] <epbernard> rather than what the Java model exposes
[2010-01-22 13:00] <epbernard> in practice, the type-safe criteria won't be useable witht he static metamodel
[2010-01-22 13:00] <sebersole> thats what i was saying i dont grok all the implications of
[2010-01-22 13:00] <epbernard> but OTOH this user clearly does not care about type safety :)
[2010-01-22 13:01] <sebersole> well the exposed type could be an interface right?
[2010-01-22 13:01] <sebersole> and the targetEntity names the concrete clas
[2010-01-22 13:01] <sebersole> really this is the type of stuff i was getting at in the split i suggested in the new metamodel
[2010-01-22 13:02] <sebersole> again not sure of names here yet as its still a work in progress...
[2010-01-22 13:03] <sebersole> but the "logical model" would reflect the targetEntity relations
[2010-01-22 13:03] <sebersole> but the "java model" or "object model" would reflect the declared types
[2010-01-22 13:04] <sebersole> in the short term, i think the static metamodel should reflect the declared types
[2010-01-22 13:04] <sebersole> iiuc
[2010-01-22 13:06] <epbernard> sebersole: well that's clearly the easiest to implement so let's go for it :)
[2010-01-22 13:07] <sebersole> epbernard, if you think its more techincally correct for the other...
[2010-01-22 13:08] <sebersole> i think its actually pretty easy in terms of populating it (no clue about the "generating it" side)
[2010-01-22 13:08] <sebersole> and could be pretty isolated to AttributeFactory
[2010-01-22 13:08] <epbernard> sebersole: I've half done the generation actually
[2010-01-22 13:08] <epbernard> it's not too hard
[2010-01-22 13:09] <sebersole> if the metamodel type is an entity type (Type.isEntity()), prefer its targetType
[2010-01-22 13:09] <sebersole> else, prefer the discovered (declared) type
{code}

> Honor targetEntity and targetClass from @XToX and @ElementCollection when populating the metamodel?
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HHH-4833
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4833
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: entity-manager
>    Affects Versions: 3.5.0-Beta-3
>            Reporter: Emmanuel Bernard
>
> Should the JPA 2 metamodel honor targetElements?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list