关于实体EJB的问题,Failed: findByPrimaryKey()??

04-02-18 www-007-www

我的运行环境是Jbuilder+Weblogic7+SQLserver2000,我的测试实体EJB的main()程序如下:

public static void main(String[] args) {

try {

MytableTestClient3 client = new MytableTestClient3();

BigDecimal id = new BigDecimal(23);

MytableRemote r = client.create(id);

r.setName("fdgh19");

r.setAddress("fgdfg19");

System.out.println("记录增加成功!!!" );

System.out.println("开始查找记录....." );

MytableRemote s = client.findByPrimaryKey(id);

System.out.println("id = " + r.getId());

System.out.println("Name = " + r.getName());

System.out.println("Address = " + s.getAddress());

System.out.println("Birth = " + s.getBirth());

System.out.println("查找记录结束!!!" );

}

catch (RemoteException ex) {

ex.printStackTrace();

}

}

执行结果如下:

(请问为什么“Failed: findByPrimaryKey(23)”,而“Succeeded: create(23)”)

C:\bea\jdk131_03\bin\javaw -classpath "D:\MY-Test\zyztest\cmpSample\classes;C:\bea\weblogic700\server\lib\weblogic.jar;C:\bea\jdk131_03\jre\lib\i18n.jar;C:\bea\jdk131_03\jre\lib\jaws.jar;C:\bea\jdk131_03\jre\lib\rt.jar;C:\bea\jdk131_03\jre\lib\sunrsasign.jar;C:\bea\jdk131_03\lib\dt.jar;C:\bea\jdk131_03\lib\htmlconverter.jar;C:\bea\jdk131_03\lib\tools.jar" cmpsample.MytableTestClient3

-- Initializing bean access.

-- Succeeded initializing bean access.

-- Execution time: 2031 ms.

-- Calling create(23)

-- Succeeded: create(23)

-- Execution time: 282 ms.

-- Return value from create(23): cmpsample.MytableBean_i8cmta_EOImpl_WLStub@6d8baea1.

记录增加成功!!!

开始查找记录.....

-- Calling findByPrimaryKey(23)

javax.ejb.FinderException: Problem in findByPrimaryKey while preparing or executing statement: 'weblogic.jdbc.rmi.SerialPreparedStatement@37a77':

java.sql.SQLException: No data found

java.sql.SQLException: No data found

at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6207)

at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3261)

at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5393)

at sun.jdbc.odbc.JdbcOdbcResultSet.getBigDecimal(JdbcOdbcResultSet.java:755)

at weblogic.jdbc.jts.ResultSet.getBigDecimal(ResultSet.java:197)

at weblogic.jdbc.rmi.internal.ResultSetImpl.getBigDecimal(ResultSetImpl.java:242)

at weblogic.jdbc.rmi.internal.ResultSetStraightReader.getBigDecimal(ResultSetStraightReader.java:77)

at weblogic.jdbc.rmi.SerialResultSet.getBigDecimal(SerialResultSet.java:248)

at cmpsample.MytableBean_i8cmta__WebLogic_CMP_RDBMS.__WL_loadGroup0FromRS(MytableBean_i8cmta__WebLogic_CMP_RDBMS.java:659)

at cmpsample.MytableBean_i8cmta__WebLogic_CMP_RDBMS.ejbFindByPrimaryKey(MytableBean_i8cmta__WebLogic_CMP_RDBMS.java:482)

at java.lang.reflect.Method.invoke(Native Method)

at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.findByPrimaryKey(RDBMSPersistenceManager.java:189)

at weblogic.ejb20.manager.BaseEntityManager.findByPrimaryKey(BaseEntityManager.java:476)

at weblogic.ejb20.manager.BaseEntityManager.remoteFindByPrimaryKey(BaseEntityManager.java:420)

at weblogic.ejb20.internal.EntityEJBHome.findByPrimaryKey(EntityEJBHome.java:373)

at cmpsample.MytableBean_i8cmta_HomeImpl.findByPrimaryKey(MytableBean_i8cmta_HomeImpl.java:106)

at cmpsample.MytableBean_i8cmta_HomeImpl_WLSkel.invoke(Unknown Source)

at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:359)

at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:114)

at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)

at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:762)

at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308)

at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)

at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)

at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)

-- Failed: findByPrimaryKey(23)

at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:109)

at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:262)

at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:229)

at cmpsample.MytableBean_i8cmta_HomeImpl_WLStub.findByPrimaryKey(Unknown Source)

at cmpsample.MytableTestClient3.findByPrimaryKey(MytableTestClient3.java:118)

at cmpsample.MytableTestClient3.main(MytableTestClient3.java:458)

-- Return value from findByPrimaryKey(23): cmpsample.MytableBean_i8cmta_EOImpl_WLStub@6d8baea1.

id = 23.00000000000000000000000000000000000

Name = fdgh19

Address = fgdfg19

Birth = null

查找记录结束!!!

www-007-www
2004-02-23 11:15
怎么没人帮我啊???

高手呢

cats_tiger
2004-02-23 19:25
你居然用JDBC-ODBC?

这样另类的应用当然每人回答!

www-007-www
2004-02-24 10:32
谢谢您,

我用的是SQL SERVER 2000,怎么办呢?

www-007-www
2004-02-27 11:34
help me !!

猜你喜欢
2Go 1 2 下一页