openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (OPENJPA-2377) Metamodel.managedType returns wrong result for Embeddable
Date Tue, 14 May 2013 16:29:17 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-2377?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Albert Lee resolved OPENJPA-2377.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3.0

Azuo,  I have resolved the issue and you can close the JIRA when you feel it has resolved
your problem.
                
> Metamodel.managedType returns wrong result for Embeddable
> ---------------------------------------------------------
>
>                 Key: OPENJPA-2377
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2377
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Azuo Lee
>            Assignee: Albert Lee
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2377.trunk.patch
>
>
> I use the following code to dynamically determine if a class is an embeddable:
> Class c = Class.forName(s);
> ManagedType type = metamodel.managedType(c);
> if (type.getPersistenceType() == Type.PersistenceType.EMBEDDABLE) {
>      logger.debug("" + c + " is an Embeddable.");
>      // do somthing with the embeddable
> }
> else if (type.getPersistenceType() == Type.PersistenceType.ENTITY) {
>      logger.debug("" + c + " is an Entity.");
>      // do somthing with the entity
> }
> but when I use this code for an Embeddable, I always get "xxx is an Entity" logged.
> After examining the source code, I found "MetamodelImpl.instantiate" method will always
put embeddable to both "embeddables" and "entities" containers, but "MetamodelImpl.managedType"
method will first search "entities" and then "embeddables" for a persistence class, thus,
"Entity" type will be returned for a ACTUAL Embeddable class.
> Hope this can be fixed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message