Hi,
I am querying from JBoss client. The query running on the server side returns a List (of Hibernate returned objects of class Person). The query text is:
"from org.rssb.entities.organization.Person per "
My Serverside method called from slsb (getting invoked) is:
public static List query(String name, Hashtable table) {
QueryHelper.getInstance();
Session session = SessionManager.getSession();
Query q1 = null;
String queryText = null;
try {
queryText = (String) queries.get(name);
q1 = session.createQuery(queryText);
} catch (HibernateException e) {
e.printStackTrace();
}
if ( table == null ) table = new Hashtable();
Enumeration en = table.keys();
while (en.hasMoreElements()) {
String key = (String) en.nextElement();
Object o = table.get(key);
if (o instanceof String) {
q1.setString(key, (String) o);
}
if (o instanceof Integer) {
q1.setInteger(key, ((Integer) o).intValue());
}
if (o instanceof Date) {
q1.setDate(key, (Date) o);
}
}
List rc = null;
try {
rc = q1.list();
session.close();
} catch (HibernateException e1) {
e1.printStackTrace();
}
catch (Exception e1) {
e1.printStackTrace();
}
return rc;
}
JBoss returns a list. However, on the client side I get the following exception as soon as my call comes back:
public static List query(String name, Hashtable table) {
String _url = "localhost:1099";
LightEjbProxy proxy =
new LightEjbProxy("org.jnp.interfaces.NamingContextFactory", _url);
List rc = null;
SLQueryHelper obj = (SLQueryHelper) proxy.getObj(JNDI_NAME);
try {
rc = obj.query(name, table);
} catch (RemoteException e) {
e.printStackTrace();
}
return rc;
}
Caused by: java.io.InvalidClassException: net.sf.hibernate.collection.PersistentCollection; local class incompatible:
What am I doing wrong? Class Person does have collection data members inside it. It is lazy tough.
I thought this was a natural way of doing client-server interaction with Hibernate.
I am still using 2.0B6
Any help is highly appreciated.
Thanks,
Vinay
=============Dump=on client side====================
java.lang.reflect.UndeclaredThrowableException
at $Proxy1.query(Unknown Source)
at org.rssb.utils.common.dbservice.client.DBSvc.query(DBSvc.java:42)
at org.rssb.utils.common.dbservice.client.DBSvc.main(DBSvc.java:50)
Caused by: java.io.InvalidClassException: net.sf.hibernate.collection.PersistentCollection; local class incompatible: stream classdesc serialVersionUID = -610623962369065059, local class serialVersionUID = -8318395321868084057
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.util.ArrayList.readObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at java.rmi.MarshalledObject.get(Unknown Source)
at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:139)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
... 3 more
Exception in thread "main"
|