Author: dgeraskov
Date: 2012-04-28 08:22:58 -0400 (Sat, 28 Apr 2012)
New Revision: 40609
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java
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/JavaPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java
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/JavaPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java
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/JavaPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java
Log:
https://issues.jboss.org/browse/JBIDE-11522
Do not expose session class in parent interface as each hibernate version loads its own.
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java 2012-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/AbstractQueryPage.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -37,7 +37,7 @@
protected PropertyChangeSupport pcs = new PropertyChangeSupport(this);
private int id;
- private Session session;
+ private Object session;
private final HibernateExtension extension;
protected List<Object> list;
protected long queryTime = -1; //shows how long query runs
@@ -93,11 +93,11 @@
this.sticky = sticky;
}
- public Session getSession() {
+ public Object getSession() {
return session;
}
- public void setSession(Session s) {
+ public void setSession(Object s) {
session = s;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java 2012-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/QueryPage.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -72,8 +72,8 @@
*/
public abstract void setSticky(boolean b);
- public Session getSession();
- public void setSession(Session session);
+ public Object getSession();
+ public void setSession(Object session);
public HibernateExtension getHibernateExtension();
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-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/HQLQueryPage.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -112,10 +112,11 @@
setTabName(getQueryString().replace('\n', ' ').replace('\r',
' ').replace('\t', ' '));
}
- public void setSession(Session s) {
+ @Override
+ public void setSession(Object s) {
super.setSession(s);
try {
- query = this.getSession().createQuery(getQueryString());
+ query = ((Session)this.getSession()).createQuery(getQueryString());
} catch (HibernateException e) {
addException(e);
} catch (Exception e) {
@@ -180,9 +181,9 @@
}
public void release() {
- if (getSession().isOpen() ) {
+ if (((Session)getSession()).isOpen() ) {
try {
- getSession().close();
+ ((Session)getSession()).close();
}
catch (HibernateException e) {
exceptions.add(e);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/JavaPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/JavaPage.java 2012-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/JavaPage.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -63,7 +63,8 @@
}
@SuppressWarnings("unchecked")
- public void setSession(Session s) {
+ @Override
+ public void setSession(Object s) {
super.setSession(s);
try {
if(criteriaCode.indexOf( "System.exit" )>=0) { // TODO: externalize
run so we don't need this bogus check! //$NON-NLS-1$
@@ -71,7 +72,7 @@
addException( new
IllegalArgumentException(ConsoleMessages.JavaPage_not_allowed) );
return;
}
- ip = setupInterpreter(getSession() );
+ ip = setupInterpreter((Session)getSession() );
Object o = ip.eval(criteriaCode);
// ugly! TODO: make un-ugly!
if(o instanceof Criteria) {
@@ -159,9 +160,9 @@
}
public void release() {
- if (getSession().isOpen() ) {
+ if (((Session)getSession()).isOpen() ) {
try {
- getSession().close();
+ ((Session)getSession()).close();
}
catch (HibernateException e) {
exceptions.add(e);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java 2012-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -299,9 +299,9 @@
@Override
public IPropertySource getPropertySource(Object object,
QueryPage selectedQueryPage) {
- Session currentSession = selectedQueryPage.getSession();
+ Session currentSession = ((Session)selectedQueryPage.getSession());
if((currentSession.isOpen() && currentSession.contains(object)) || hasMetaData(
object, currentSession) ) {
- return new EntityPropertySource(object, selectedQueryPage.getSession(),
hibernateExtension);
+ return new EntityPropertySource(object, currentSession, hibernateExtension);
}
return null;
}
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-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/HQLQueryPage.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -112,10 +112,11 @@
setTabName(getQueryString().replace('\n', ' ').replace('\r',
' ').replace('\t', ' '));
}
- public void setSession(Session s) {
+ @Override
+ public void setSession(Object s) {
super.setSession(s);
try {
- query = this.getSession().createQuery(getQueryString());
+ query = ((Session)this.getSession()).createQuery(getQueryString());
} catch (HibernateException e) {
addException(e);
} catch (Exception e) {
@@ -180,9 +181,9 @@
}
public void release() {
- if (getSession().isOpen() ) {
+ if (((Session)getSession()).isOpen() ) {
try {
- getSession().close();
+ ((Session)getSession()).close();
}
catch (HibernateException e) {
exceptions.add(e);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/JavaPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/JavaPage.java 2012-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/JavaPage.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -63,7 +63,8 @@
}
@SuppressWarnings("unchecked")
- public void setSession(Session s) {
+ @Override
+ public void setSession(Object s) {
super.setSession(s);
try {
if(criteriaCode.indexOf( "System.exit" )>=0) { // TODO: externalize
run so we don't need this bogus check! //$NON-NLS-1$
@@ -71,7 +72,7 @@
addException( new
IllegalArgumentException(ConsoleMessages.JavaPage_not_allowed) );
return;
}
- ip = setupInterpreter(getSession() );
+ ip = setupInterpreter((Session)getSession() );
Object o = ip.eval(criteriaCode);
// ugly! TODO: make un-ugly!
if(o instanceof Criteria) {
@@ -159,9 +160,9 @@
}
public void release() {
- if (getSession().isOpen() ) {
+ if (((Session)getSession()).isOpen() ) {
try {
- getSession().close();
+ ((Session)getSession()).close();
}
catch (HibernateException e) {
exceptions.add(e);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java 2012-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -318,9 +318,9 @@
@Override
public IPropertySource getPropertySource(Object object,
QueryPage selectedQueryPage) {
- Session currentSession = selectedQueryPage.getSession();
+ Session currentSession = (Session)selectedQueryPage.getSession();
if((currentSession.isOpen() && currentSession.contains(object)) || hasMetaData(
object, currentSession) ) {
- return new EntityPropertySource(object, selectedQueryPage.getSession(),
hibernateExtension);
+ return new EntityPropertySource(object, currentSession, hibernateExtension);
}
return null;
}
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-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/HQLQueryPage.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -30,6 +30,7 @@
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
+import org.hibernate.SharedSessionContract;
import org.hibernate.console.AbstractQueryPage;
import org.hibernate.console.ConsoleQueryParameter;
import org.hibernate.console.QueryInputModel;
@@ -112,10 +113,11 @@
setTabName(getQueryString().replace('\n', ' ').replace('\r',
' ').replace('\t', ' '));
}
- public void setSession(Session s) {
+ @Override
+ public void setSession(Object s) {
super.setSession(s);
try {
- query = this.getSession().createQuery(getQueryString());
+ query = ((Session) this.getSession()).createQuery(getQueryString());
} catch (HibernateException e) {
addException(e);
} catch (Exception e) {
@@ -180,9 +182,9 @@
}
public void release() {
- if (getSession().isOpen() ) {
+ if (((Session)getSession()).isOpen() ) {
try {
- getSession().close();
+ ((Session)getSession()).close();
}
catch (HibernateException e) {
exceptions.add(e);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/JavaPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/JavaPage.java 2012-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/JavaPage.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -63,7 +63,8 @@
}
@SuppressWarnings("unchecked")
- public void setSession(Session s) {
+ @Override
+ public void setSession(Object s) {
super.setSession(s);
try {
if(criteriaCode.indexOf( "System.exit" )>=0) { // TODO: externalize
run so we don't need this bogus check! //$NON-NLS-1$
@@ -71,7 +72,7 @@
addException( new
IllegalArgumentException(ConsoleMessages.JavaPage_not_allowed) );
return;
}
- ip = setupInterpreter(getSession() );
+ ip = setupInterpreter((Session)getSession() );
Object o = ip.eval(criteriaCode);
// ugly! TODO: make un-ugly!
if(o instanceof Criteria) {
@@ -159,9 +160,9 @@
}
public void release() {
- if (getSession().isOpen() ) {
+ if (((Session)getSession()).isOpen() ) {
try {
- getSession().close();
+ ((Session)getSession()).close();
}
catch (HibernateException e) {
exceptions.add(e);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java 2012-04-28
01:33:40 UTC (rev 40608)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java 2012-04-28
12:22:58 UTC (rev 40609)
@@ -316,9 +316,9 @@
@Override
public IPropertySource getPropertySource(Object object,
QueryPage selectedQueryPage) {
- Session currentSession = selectedQueryPage.getSession();
+ Session currentSession = (Session)selectedQueryPage.getSession();
if((currentSession.isOpen() && currentSession.contains(object)) || hasMetaData(
object, currentSession) ) {
- return new EntityPropertySource(object, selectedQueryPage.getSession(),
hibernateExtension);
+ return new EntityPropertySource(object, currentSession, hibernateExtension);
}
return null;
}