User: peter
Date: 01/02/14 18:29:49
Modified: src/main/org/jboss/test/cts/ejb CtsBmpBean.java
StatelessSessionBean.java
Log:
More tests for BMP in JCTS.
Revision Changes Path
1.2 +61 -5 jbosstest/src/main/org/jboss/test/cts/ejb/CtsBmpBean.java
Index: CtsBmpBean.java
===================================================================
RCS file:
/products/cvs/ejboss/jbosstest/src/main/org/jboss/test/cts/ejb/CtsBmpBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CtsBmpBean.java 2001/01/25 02:45:33 1.1
+++ CtsBmpBean.java 2001/02/15 02:29:47 1.2
@@ -51,7 +51,7 @@
throws CreateException, DuplicateKeyException, EJBException,
RemoteException
{
- System.out.println("ejbCreate (AccountPK, String) called");
+ System.out.println("entry ejbCreate");
tearDown();
setUp();
@@ -128,7 +128,7 @@
public AccountPK ejbFindByPrimaryKey (AccountPK pk)
throws FinderException, EJBException, RemoteException
{
- System.out.println("ejbFindByPrimaryKey (Integer) called");
+ System.out.println("entry ejbFindByPrimaryKey");
Connection con = null;
boolean found = false;
@@ -152,7 +152,7 @@
}
catch (Exception ex)
{
- throw new EJBException("couldnt seek: " + ex.getMessage());
+ throw new EJBException("couldnt find: " + ex.getMessage());
}
finally
{
@@ -185,7 +185,7 @@
public Collection ejbFindAll ()
throws EJBException, FinderException, RemoteException
{
- System.out.println("ejbFindAll () called");
+ System.out.println("entry ejbFindAll");
Connection con = null;
Vector result = new Vector();
@@ -200,7 +200,8 @@
while (rs.next())
{
- result.add(rs.getString("accountNumber"));
+ // Return PK's of result set
+ result.add( new AccountPK(rs.getString("accountNumber") ));
}
rs.close();
@@ -221,6 +222,61 @@
return result;
}
+
+ /**
+ * Method ejbFindByPersonsName
+ *
+ *
+ * @return
+ *
+ * @throws EJBException
+ * @throws FinderException
+ * @throws RemoteException
+ *
+ */
+ public Collection ejbFindByPersonsName (String guysName )
+ throws EJBException, FinderException, RemoteException
+ {
+ System.out.println("entry ejbFindByPersonsName");
+
+ Connection con = null;
+ Vector result = new Vector();
+
+ try
+ {
+ con = ds.getConnection();
+
+ Statement s = con.createStatement();
+ ResultSet rs = s.executeQuery("SELECT accountNumber FROM "
+ + TABLE_NAME + " WHERE name='" + guysName +
"'" );
+
+ while (rs.next())
+ {
+ // Return PK's of result set
+ String accountNumber = rs.getString("accountNumber");
+ result.addElement( new AccountPK( accountNumber ));
+ System.out.println( "Adding: " + accountNumber + " to result set" );
+ }
+
+ rs.close();
+ s.close();
+ }
+ catch (Exception ex)
+ {
+ throw new EJBException("couldnt find: " + ex.getMessage());
+ }
+ finally
+ {
+ try
+ {
+ if (con != null) con.close();
+ }
+ catch (Exception _sqle){}
+ }
+
+ return result;
+ }
+
/**
* Method ejbPostCreate
1.7 +10 -0
jbosstest/src/main/org/jboss/test/cts/ejb/StatelessSessionBean.java
Index: StatelessSessionBean.java
===================================================================
RCS file:
/products/cvs/ejboss/jbosstest/src/main/org/jboss/test/cts/ejb/StatelessSessionBean.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- StatelessSessionBean.java 2001/02/01 02:23:26 1.6
+++ StatelessSessionBean.java 2001/02/15 02:29:48 1.7
@@ -114,3 +114,13 @@
/*------ Formatted by Jindent 3.23 Basic 1.0 --- http://www.jindent.de ------*/
+
+
+
+
+
+
+
+
+
+