请问个relationship和事务的问题

Csharp 2004-09-22 11:07:12
我的两个cmp2.0 entity bean(ksscode和rfperson),
用了relationship,但是用jsp调用的时候出错(关于事物的),
jsp代码如下:





<%@ page import="proj_wf.*,javax.naming.*,
java.util.Properties,
javax.rmi.PortableRemoteObject"
%>

<%
long startTime = 0;
startTime = System.currentTimeMillis();
try {
System.out.println("111");
Context context = new InitialContext();
System.out.println("222");

Object ref = context.lookup("rfperson");
System.out.println("333");
rfpersonHome rfpersonHome1 = (rfpersonHome)ref;
System.out.println("444");
java.util.Collection c=rfpersonHome1.findSex();
System.out.println("555");
java.util.Iterator i=c.iterator();
System.out.println("666");
while(i.hasNext()){
System.out.println("777");
rfperson rfperson1=(rfperson)i.next();
System.out.println("888");
java.util.Collection c1=rfperson1.getKsscode1();
System.out.println("999");
java.util.Iterator i1=c1.iterator();
System.out.println("000");
while(i1.hasNext()){
System.out.println("a111");
ksscode ksscode1=(ksscode)i1.next();
System.out.println("a222");
if(ksscode1.getDic_name()=="cccode_c"){
System.out.println("a333");
System.out.println(ksscode1.getText());
System.out.println("a444");
}
}

}
long endTime = System.currentTimeMillis();
System.out.println("Execution time: " + (endTime - startTime) + " ms.");
}

catch(Exception e) {
e.printStackTrace();
}

%>

weblogic7终端输出如下:

111
222
333
444
555
666
777
888
999
java.lang.IllegalStateException: Attempted to access the collection valued cmr-f
ield, 'ksscode1', for bean, 'rfperson', outside the scope of a transaction. All
access to the collection must be performed during the transaction in which the c
ollection was initially retrieved.


谁能告诉我怎么解决,多谢!

...全文
79 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
mazekui 2004-09-22
  • 打赏
  • 举报
回复
看不出问题来!我也帮你顶!
Csharp 2004-09-22
  • 打赏
  • 举报
回复
顶一下,谁来帮我?

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧