Patches item #486027, was opened at 2001-11-27 07:37
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376687&aid=486027&group_id=22866
Category: JBossCMP
Group: v2.4 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Bani Greyling (banigreyling)
Assigned to: Nobody/Anonymous (nobody)
Summary: Incorrect ObjectNotFoundException
Initial Comment:
I have a problem when doing a findByPrimaryKey (CMP)
and the pool give out a dead
connection. I think I got to the source of the
problem.
While doing a findByPrimaryKey JBoss first determine
if the object exist by doing a
count. If this count fail (because the pool gave a
dead connection), then the exeption
is ignored and false is returned as described by the
following code fragment:
(from
org.jboss.ejb.plugins.jaws.jdbc.JDBCBeanExistsCommand.j
ava)
public boolean execute(Object id)
{
boolean result = false;
try
{
result = ((Boolean)jdbcExecute
(id)).booleanValue();
} catch (Exception e)
{
log.debug(e);
}
return result;
}
Subsequently the follwing code fragment from
org.jboss.ejb.plugins.jaws.jdbc.JDBCFindEntityCommand.j
ava throw an
ObjectNotFoundException which result in the client
getting message that the record
does not exist.
protected Object findByPrimaryKey(Object id) throws
FinderException
{
if (beanExistsCommand.execute(id))
{
return id;
} else
{
throw new ObjectNotFoundException("Object
with primary key " + id +
" not found
in storage");
}
}
I feel that the first mentioned codefragment should be
changed to:
public boolean execute(Object id)
throws FinderException
{
boolean result = false;
try
{
result = ((Boolean)jdbcExecute
(id)).booleanValue();
} catch (Exception e)
{
log.debug(e);
throw new FinderException(e.toString());
}
return result;
}
This will ensure that the client is informed that his
request could not be serviced.
My current configuration:
JBoss 2.4.1
JDK 1.3
Windows NT4
MS SQLServer2000
com.jnetdirect.jsql.JSQLDriver
Unified diff:
--- JDBCBeanExistsCommand.java~1~ Sat Jul 14
21:43:24 2001
+++ JDBCBeanExistsCommand.java Tue Nov 27 12:12:28
2001
@@ -10,6 +10,7 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import javax.ejb.FinderException;
import org.jboss.ejb.EntityEnterpriseContext;
@@ -38,6 +39,7 @@
// Checks whether the database already holds the
entity
public boolean execute(Object id)
+ throws FinderException
{
boolean result = false;
@@ -47,6 +49,7 @@
} catch (Exception e)
{
log.debug(e);
+ throw new FinderException(e.toString());
}
return result;
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376687&aid=486027&group_id=22866
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development