[jbosstools-commits] JBoss Tools SVN: r22544 - in trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console: views/properties and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Jun 4 09:35:48 EDT 2010


Author: vyemialyanchyk
Date: 2010-06-04 09:35:48 -0400 (Fri, 04 Jun 2010)
New Revision: 22544

Modified:
   trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
   trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
   trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java
Log:
https://jira.jboss.org/browse/JBIDE-6407 - fixed

Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java	2010-06-04 11:39:42 UTC (rev 22543)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java	2010-06-04 13:35:48 UTC (rev 22544)
@@ -157,6 +157,7 @@
 	//
 	public static String EntityPropertySource_identifier;
 	public static String EntityPropertySource_properties;
+	public static String EntityPropertySource_unable_to_resolve_property;
 	public static String QueryPagePropertySource_console_configuration;
 	public static String QueryPagePropertySource_millisec;
 	public static String QueryPagePropertySource_query_run_time;

Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties	2010-06-04 11:39:42 UTC (rev 22543)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties	2010-06-04 13:35:48 UTC (rev 22544)
@@ -150,6 +150,7 @@
 
 EntityPropertySource_identifier=Identifier
 EntityPropertySource_properties=Properties
+EntityPropertySource_unable_to_resolve_property=<Unable to resolve property>
 QueryPagePropertySource_console_configuration=Console configuration
 # {0}=count in millisec
 QueryPagePropertySource_millisec={0} millisec

Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java	2010-06-04 11:39:42 UTC (rev 22543)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/properties/EntityPropertySource.java	2010-06-04 13:35:48 UTC (rev 22544)
@@ -27,6 +27,7 @@
 import org.eclipse.ui.views.properties.IPropertySource2;
 import org.eclipse.ui.views.properties.PropertyDescriptor;
 import org.hibernate.EntityMode;
+import org.hibernate.HibernateException;
 import org.hibernate.Session;
 import org.hibernate.console.ConsoleConfiguration;
 import org.hibernate.console.KnownConfigurations;
@@ -35,7 +36,9 @@
 import org.hibernate.eclipse.console.HibernateConsoleMessages;
 import org.hibernate.metadata.ClassMetadata;
 import org.hibernate.metadata.CollectionMetadata;
+import org.hibernate.persister.entity.AbstractEntityPersister;
 import org.hibernate.proxy.HibernateProxyHelper;
+import org.hibernate.tuple.entity.EntityMetamodel;
 
 
 
@@ -124,7 +127,21 @@
 		if(id.equals(classMetadata.getIdentifierPropertyName())) {
 			propertyValue = classMetadata.getIdentifier(reflectedObject, EntityMode.POJO);
 		} else {
-			propertyValue = classMetadata.getPropertyValue(reflectedObject, (String)id, EntityMode.POJO);
+			try {
+				propertyValue = classMetadata.getPropertyValue(reflectedObject, (String)id, EntityMode.POJO);
+			} catch (HibernateException he) {
+				propertyValue = HibernateConsoleMessages.EntityPropertySource_unable_to_resolve_property;
+				if (classMetadata instanceof AbstractEntityPersister) {
+					AbstractEntityPersister aep = (AbstractEntityPersister)classMetadata;
+					EntityMetamodel emm = aep.getEntityMetamodel();
+					if (emm != null) {
+						Integer idx = emm.getPropertyIndexOrNull((String)id);
+						if (idx != null) {
+							propertyValue = emm.getTuplizer(EntityMode.POJO).getPropertyValue(reflectedObject, idx);
+						}
+					}
+				}
+			}
 		}
 
 		if (propertyValue instanceof Collection<?>) {



More information about the jbosstools-commits mailing list