Entity Beans And JDBC

Discussions

EJB programming & troubleshooting: Entity Beans And JDBC

  1. Entity Beans And JDBC (1 messages)

    Hi all,
    I am not sure whether this question belongs to this forum. But I have a JDBC question. I am setting my preparedStatement with the following flags:

    conn.prepareStatement(stmt,ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

    Which would allow me to know how many rows were returned by the result set:

    rst = ps.executeQuery();
    //We need to know how many rows were returned. This is done
    //by pushing the pointer to the last row and then getting
    // the row number.
    rst.last();
    int count = rst.getRow();
    // Now push it back to the row before first
    rst.beforeFirst();

    This works fine within my session facade, but when I call the same code from my entity bean it returns 0. Now I know tthe sql returns 13 rows. I have been trying to find out what is going on with no avail.

    Can any one tell me why?

    Thanks in advance.
    -r
  2. Entity Beans And JDBC[ Go to top ]

    EJB servers do stranges this with their JDBC object. My guess is that your EJB server is not returning a "raw" ResultSet to your Entity EJB, but is returning some sort of custom wrapper object to get better control of the database operations. This Entity ResultSet wrapper may be disabling some functions.

    Try logging rs.getClass() in both your Session Bean and Entity Bean, and see if you are getting the same class in both cases.