类型转换?能否说清楚点!
我调试了,这个出错信息实在Collection c = supplierHome.findAll();这句抛出的,
但是我用System.out.println(c.size());可以显示表中记录数,记录数显示在出错信息的下面!
不明白!
我调试了,这个出错信息实在Collection c = supplierHome.findAll();这句抛出的,
但是我用System.out.println(c.size());可以显示表中记录数,记录数显示在出错信息的下面!
不明白!
Supplier类应该为实体bean的home接口
用这种方法试试:
i=c.size();
while(i>=1)
{
Supplier supplier = (Supplier)iterator.next();
System.out.println("the ordersitem's orderid "+ supplier.getShortName());
i=i-1;
}
http://expert.csdn.net/Expert/topic/2166/2166162.xml?temp=.4388849是不是也是这个问题?
我用你的方法,还是同样的错误!!!!
Supplier类应该为实体bean的远程接口类
看看你的实体bean里面findAll函数是怎么实现的,返回的collection到底封装了什么类型的类,如果看不懂的话把findAll()这个函数贴出来。
while (true) {
if (!_is_local()) {
org.omg.CORBA.portable.OutputStream _output = null;
org.omg.CORBA.portable.InputStream _input = null;
java.util.Collection _result;
try {
_output = this._request("findAll", true);
_input = this._invoke(_output);
_result = (java.util.Collection)((org.omg.CORBA_2_3.portable.InputStream)_input).read_value(java.util.Collection.class);
return _result;
}
catch (org.omg.CORBA.portable.ApplicationException _exception) {
final org.omg.CORBA.portable.InputStream in = _exception.getInputStream();
java.lang.String _exception_id = _exception.getId();
if (_exception_id.equals("IDL:javax/ejb/FinderEx:1.0")) {
_exception_id = in.read_string();
throw (javax.ejb.FinderException)((org.omg.CORBA_2_3.portable.InputStream)in).read_value();
}
//FIX: Wrap original Exception here?
throw new java.rmi.UnexpectedException("Unexpected User Exception: " + _exception_id);
}
catch (org.omg.CORBA.portable.RemarshalException _exception) {
continue;
}
finally {
this._releaseReply(_input);
}
} else {
final org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("findAll", _opsClass);
if (_so == null) {
continue;
}
final supplier.SupplierHomeOperations _self = (supplier.SupplierHomeOperations)_so.servant;
try {
java.util.Collection _ret = _self.findAll();
if (_so instanceof org.omg.CORBA.portable.ServantObjectExt) {
((org.omg.CORBA.portable.ServantObjectExt)_so).normalCompletion();
}
return _ret;
} catch (javax.ejb.FinderException x_1) {
if (_so instanceof org.omg.CORBA.portable.ServantObjectExt) {
((org.omg.CORBA.portable.ServantObjectExt)_so).exceptionalCompletion((Throwable)x_1);
}
throw x_1;
} catch (java.lang.RuntimeException re) {
if (_so instanceof org.omg.CORBA.portable.ServantObjectExt) {
((org.omg.CORBA.portable.ServantObjectExt)_so).exceptionalCompletion((Throwable)re);
}
throw re;
} catch (java.lang.Error err) {
if (_so instanceof org.omg.CORBA.portable.ServantObjectExt) {
((org.omg.CORBA.portable.ServantObjectExt)_so).exceptionalCompletion((Throwable)err);
}
throw err;
} finally {
_servant_postinvoke(_so);
}
}
}
}
catch (org.omg.CORBA.portable.UnknownException ex) {
if (ex.originalEx instanceof java.lang.RuntimeException) {
throw (java.lang.RuntimeException) ex.originalEx;
} else if (ex.originalEx instanceof Exception) {
throw new java.rmi.ServerException(ex.getMessage(), (java.lang.Exception)ex.originalEx);
} else {
throw new java.rmi.ServerError(ex.getMessage(), (java.lang.Error) ex.originalEx);
}
}
catch (org.omg.CORBA.SystemException ex) {
throw javax.rmi.CORBA.Util.mapSystemException(ex);
}
}
错误抛出在这句:
Supplier supplier = (Supplier)iterator.next();
System.out.println("ok");"ok" 不会输出,如果屏蔽掉Supplier supplier = (Supplier)iterator.next();则没有错误提示!!!!