-
1. Re: Strange behaviour
aloubyansky Sep 23, 2004 4:23 AM (in response to gchini)Are you accessing exactly the same DataSource used by the entity beans?
-
2. Re: Strange behaviour
gchini Sep 23, 2004 4:34 AM (in response to gchini)Yes,
the datasource is the same...
With jboss 3.0.4 it works fine, but not with 3.2.5
Thanks -
3. Re: Strange behaviour
aloubyansky Sep 23, 2004 4:50 AM (in response to gchini)You should to provide a testcase as it works for me:
log.debug("RUN>");
CLocal c = CUtil.getLocalHome().create(new Long(1));
DataSource ds = (DataSource)new InitialContext().lookup("java:/DefaultDS");
Connection con = null;
PreparedStatement st = null;
ResultSet rs = null;
try
{
con = ds.getConnection();
final String sql = "select * from c where id=?";
log.debug("executing: " + sql);
st = con.prepareStatement(sql);
st.setInt(1, 1);
rs = st.executeQuery();
if(rs.next())
{
log.debug("FOUND");
}
else
{
log.debug("NOT FOUND");
}
}
finally
{
JDBCUtil.safeClose(rs);
JDBCUtil.safeClose(st);
JDBCUtil.safeClose(con);
}
log.debug("RUN> done in " + (System.currentTimeMillis() - startTime) + " ms.");
10:49:20,128 DEBUG [FacadeSessionBean] RUN>
10:49:20,148 DEBUG [C] Executing SQL: SELECT COUNT(*) FROM C WHERE id=?
10:49:20,158 DEBUG [C] Executing SQL: INSERT INTO C (id, firstName, lastName, a_id) VALUES (?, ?, ?, ?)
10:49:20,178 DEBUG [FacadeSessionBean] executing: select * from c where id=?
10:49:20,178 DEBUG [FacadeSessionBean] FOUND
10:49:20,178 DEBUG [FacadeSessionBean] RUN> done in 50 ms. -
4. Re: Strange behaviour
gchini Sep 23, 2004 6:17 AM (in response to gchini)My scenario si more complex..
The query command (and the datasource lookup) is made by another EJB Stateful ( it serves in other cases to paginate the results ).
I create this ejb (the create method makes the query) and then I call a getAll method wich returns all the data retrieved by the query.
Thanks. -
5. Re: Strange behaviour
gchini Sep 24, 2004 2:16 AM (in response to gchini)May be it is a commit option setting??