before the update :
public void beforeStatementClose(Statement stmt, ResultSet rs) throws PlatformException {
if (rs != null) {
try { rs.close(); } catch (SQLException e) { throw new PlatformException("Resultset closing failed", e); }
}
}
and after :
public void beforeStatementClose(Statement stmt, ResultSet rs) throws PlatformException {
if (rs != null) {
try { rs.close(); } catch (SQLException e) { if (!"ResultSet is closed".equals(e.getMessage()))
throw new PlatformException("Resultset closing failed", e); }
}
}
It works but I would prefer to not modify the OJB distribution...
OK, here it is : I don't know if it can help :
public void testQuery() throws Exception
{
PersistenceManager pm = PersistenceManager.getInstance();
Transaction tx = pm.currentTransaction();
tx.begin();
Manager manager = newManager();
manager.setName("John Smith");
manager.setProjectNumber(new Integer(10));
pm.makePersistent(manager);
Employee employee = newEmployee();
employee.setName("David Cosby");
pm.makePersistent(employee);
tx.commit();
Criteria crit = new Criteria();
Query q = QueryFactory.newQuery(EmployeeImpl.class, crit);
Collection results = broker.getCollectionByQuery(q);
assertTrue(results.size() == 2);
Iterator it = results.iterator();
while (it.hasNext()) {
Employee eCurr = (Employee) it.next();
System.out.println(eCurr.getName());
}
}
Regards,
Laurent
Matthew Baird a écrit:
from the stack trace it looks like you have a test case. Care to donate it so we can use it to solve the problem and prevent a regression?
-----Original Message----- From: Laurent BARESSE [mailto:[EMAIL PROTECTED]] Sent: Thu 1/16/2003 6:47 AM To: OJB Users List Cc: Subject: [DefaultPlatformImpl] Throws "Resultset closing failed: ResultSetis close"
Dear all,
I've seen a previous post from "Corey Klaasmeyer <[EMAIL PROTECTED]>"
on Fri, 8 Nov 2002 asking about any solution to this issue in the
mailing list archive. But I don't have found any answer neither any
explanation...
is it a bug or not ? any correction are foreseen ? how can I avoid
theses exceptions if I want to access a SQL Server database ?
Just to remind you what is the exception :
rethrown as org.apache.ojb.broker.platforms.PlatformException: Resultset
closing failed: ResultSet is closed
at
org.apache.ojb.broker.platforms.PlatformDefaultImpl.beforeStatementClose(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.StatementManager.closeResources(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.RsIterator.releaseDbResources(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.ChainingIterator.releaseDbResources(Unknown
Source)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
at
org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getCollectionByQuery(Unknown
Source)
at ojbtest.EmployeeTest.testQuery(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.doRun(TestRunner.java:109)
at junit.textui.TestRunner.run(TestRunner.java:72)
at junit.textui.TestRunner.run(TestRunner.java:57)
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
<http://www.silogic.fr/> Agence Scientifique et Industrielle Laurent BARESSE <mailto:[EMAIL PROTECTED]> Ingénieur d'études - Architecte Tél. : +33 534 619 292 - Fax : +33 534 619 222 e-mail : [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 6, rue Roger Camboulives - BP 1133 - 31036 Toulouse Cedex 01 - FRANCE
