请问个relationship和事务的问题
我的两个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.
谁能告诉我怎么解决,多谢!