[jbosstools-commits] JBoss Tools SVN: r42668 - in trunk/hibernatetools/plugins: org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views and 3 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Mon Jul 23 05:36:42 EDT 2012
Author: dgeraskov
Date: 2012-07-23 05:36:41 -0400 (Mon, 23 Jul 2012)
New Revision: 42668
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleQueryParameter.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HQLQueryPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/HQLQueryPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HQLQueryPage.java
Log:
https://issues.jboss.org/browse/JBIDE-12354
Use string type name to prevent class loading by other class loader
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleQueryParameter.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleQueryParameter.java 2012-07-23 09:30:23 UTC (rev 42667)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleQueryParameter.java 2012-07-23 09:36:41 UTC (rev 42668)
@@ -102,8 +102,8 @@
this.name = name;
}
- public NullableType getType() {
- return type;
+ public String getTypeName() {
+ return type.getName();
}
public void setType(NullableType type) {
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java 2012-07-23 09:30:23 UTC (rev 42667)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryParametersPage.java 2012-07-23 09:36:41 UTC (rev 42668)
@@ -213,7 +213,7 @@
while(iterator.hasNext()) {
NullableType type = (NullableType) iterator.next();
if(i==((Integer)value).intValue()) {
- if(cqp.getType()!=type) {
+ if(!cqp.getTypeName().equals(type.getName())) {
cqp.setType(type);
cqp.setNull(); // have to reset to ensure it's working
}
@@ -258,10 +258,10 @@
}
if ( TYPE_PROPERTY.equals( property ) ) {
Iterator<Type> iterator = possibleTypes.iterator();
- NullableType type = cqp.getType();
+ String type = cqp.getTypeName();
int i = 0;
while(iterator.hasNext()) {
- if (type == iterator.next()) {
+ if (type.equals(iterator.next().getName())) {
return Integer.valueOf(i);
}
i++;
@@ -360,7 +360,7 @@
case 0:
return cqp.getName();
case 1:
- return cqp.getType().getName();
+ return cqp.getTypeName();
case 2:
{
String label = cqp.getStringValues()[0];
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HQLQueryPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HQLQueryPage.java 2012-07-23 09:30:23 UTC (rev 42667)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HQLQueryPage.java 2012-07-23 09:36:41 UTC (rev 42668)
@@ -35,6 +35,7 @@
import org.hibernate.console.QueryInputModel;
import org.hibernate.console.ext.HibernateExtension;
import org.hibernate.type.Type;
+import org.hibernate.type.TypeFactory;
public class HQLQueryPage extends AbstractQueryPage {
@@ -84,14 +85,17 @@
try {
int pos = Integer.parseInt(parameter.getName());
//FIXME no method to set positioned list value
- query2.setParameter(pos, calcValue( parameter ), parameter.getType());
+ query2.setParameter(pos, calcValue( parameter ),
+ TypeFactory.heuristicType(parameter.getTypeName()));
} catch(NumberFormatException nfe) {
Object value = parameter.getValue();
if (value != null && value.getClass().isArray()){
Object[] values = (Object[])value;
- query2.setParameterList(parameter.getName(), Arrays.asList(values), parameter.getType());
+ query2.setParameterList(parameter.getName(), Arrays.asList(values),
+ TypeFactory.heuristicType(parameter.getTypeName()));
} else {
- query2.setParameter(parameter.getName(), calcValue( parameter ), parameter.getType());
+ query2.setParameter(parameter.getName(), calcValue( parameter ),
+ TypeFactory.heuristicType(parameter.getTypeName()));
}
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/HQLQueryPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/HQLQueryPage.java 2012-07-23 09:30:23 UTC (rev 42667)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/HQLQueryPage.java 2012-07-23 09:36:41 UTC (rev 42668)
@@ -34,6 +34,7 @@
import org.hibernate.console.ConsoleQueryParameter;
import org.hibernate.console.QueryInputModel;
import org.hibernate.console.ext.HibernateExtension;
+import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.Type;
@@ -41,6 +42,7 @@
private Query query;
private String queryString;
+ private BasicTypeRegistry defaultBasicTypeRegistry = new BasicTypeRegistry();
public List<Object> getList() {
if (query==null) return Collections.emptyList();
@@ -84,14 +86,17 @@
try {
int pos = Integer.parseInt(parameter.getName());
//FIXME no method to set positioned list value
- query2.setParameter(pos, calcValue( parameter ), parameter.getType());
+ query2.setParameter(pos, calcValue( parameter ),
+ defaultBasicTypeRegistry.getRegisteredType(parameter.getTypeName()));
} catch(NumberFormatException nfe) {
Object value = parameter.getValue();
if (value != null && value.getClass().isArray()){
Object[] values = (Object[])value;
- query2.setParameterList(parameter.getName(), Arrays.asList(values), parameter.getType());
+ query2.setParameterList(parameter.getName(), Arrays.asList(values),
+ defaultBasicTypeRegistry.getRegisteredType(parameter.getTypeName()));
} else {
- query2.setParameter(parameter.getName(), calcValue( parameter ), parameter.getType());
+ query2.setParameter(parameter.getName(), calcValue( parameter ),
+ defaultBasicTypeRegistry.getRegisteredType(parameter.getTypeName()));
}
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HQLQueryPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HQLQueryPage.java 2012-07-23 09:30:23 UTC (rev 42667)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HQLQueryPage.java 2012-07-23 09:36:41 UTC (rev 42668)
@@ -35,6 +35,8 @@
import org.hibernate.console.ConsoleQueryParameter;
import org.hibernate.console.QueryInputModel;
import org.hibernate.console.ext.HibernateExtension;
+import org.hibernate.type.BasicType;
+import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.Type;
@@ -42,6 +44,7 @@
private Query query;
private String queryString;
+ private BasicTypeRegistry defaultBasicTypeRegistry = new BasicTypeRegistry();
public List<Object> getList() {
if (query==null) return Collections.emptyList();
@@ -85,14 +88,17 @@
try {
int pos = Integer.parseInt(parameter.getName());
//FIXME no method to set positioned list value
- query2.setParameter(pos, calcValue( parameter ), parameter.getType());
+ query2.setParameter(pos, calcValue( parameter ),
+ defaultBasicTypeRegistry.getRegisteredType(parameter.getTypeName()));
} catch(NumberFormatException nfe) {
Object value = parameter.getValue();
if (value != null && value.getClass().isArray()){
Object[] values = (Object[])value;
- query2.setParameterList(parameter.getName(), Arrays.asList(values), parameter.getType());
+ query2.setParameterList(parameter.getName(), Arrays.asList(values),
+ defaultBasicTypeRegistry.getRegisteredType(parameter.getTypeName()));
} else {
- query2.setParameter(parameter.getName(), calcValue( parameter ), parameter.getType());
+ query2.setParameter(parameter.getName(), calcValue( parameter ),
+ defaultBasicTypeRegistry.getRegisteredType(parameter.getTypeName()));
}
}
}
More information about the jbosstools-commits
mailing list