Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8E0551094E for ; Thu, 25 Apr 2013 10:20:19 +0000 (UTC) Received: (qmail 20307 invoked by uid 500); 25 Apr 2013 10:20:18 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 20153 invoked by uid 500); 25 Apr 2013 10:20:17 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 20097 invoked by uid 99); 25 Apr 2013 10:20:17 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Apr 2013 10:20:17 +0000 Date: Thu, 25 Apr 2013 10:20:17 +0000 (UTC) From: "Azuo Lee (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (OPENJPA-2377) Metamodel.managedType returns wrong result for Embeddable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-2377?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Azuo Lee updated OPENJPA-2377: ------------------------------ Description: 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. was: 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. > 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 > > 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