Hi Vijay,

I had a look at the code of SequenceKeyGenerator. JBoss seams to be right that we open a ResultSet that we do not close after usage but according to the javadoc of java.sql.ResultSet will it be closed automaticaly when the Statement which produced it will be closed, and this we do. Until now we never had problem with that way of automaticaly closing resultsets through statements.

If you think this should be change, please fill a new issue in jira and attach mapping, code snipped and stacktrace from your mail.

Regards
Ralf

vsukumar schrieb:

I was not executing any SQL statement, just create using this mapping where
session_log_seq exits in oracle, since I am not using any SQL/OQL ,  there
is no handle to resultSet. I was curious if I was missing something in the
mapping. I don't thing JBoss closing the result set hurts, but I wanted to
know if I am doing it the right way.

   <key-generator name="SEQUENCE" alias="session_log_seq">
       <param name="sequence" value="session_log_seq"/>
   </key-generator>

<class name="com.PCPgo.prm.web.audit.SessionLogJdo" identity="slId"
key-generator="session_log_seq">
       <description>Session Log Record</description>
       <map-to table="session_log"/>
       <field name="slId" type="long">
           <sql name="sl_id" type="bigint"/>
       </field>
       <field name="ipAddress" type="string">
           <sql name="ip_addr" type="varchar"/>
       </field>
       <field name="loginSuccess" type="boolean"
set-method="setLoginSuccess" get-method="isLoginSuccess">
           <sql name="login_success" type="char[01]"/>
       </field>
       <field name="logoutSuccess" type="boolean"
set-method="setLogoutSuccess" get-method="isLogoutSuccess">
           <sql name="logout_success" type="char[01]"/>
       </field>
       <field name="sessionId" type="string">
           <sql name="session_ident" type="varchar"/>
       </field>
       <field name="time" type="date">
           <sql name="access_time" type="timestamp"/>
       </field>
       <field name="username" type="string">
           <sql name="user_name" type="varchar"/>
       </field>
   </class>


Thanks

Vijay

-----Original Message-----
From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 04, 2005 6:58 PM
To: [email protected]
Subject: Re: [castor-user] ResultSet Open when using db.create . Please help

I cant see your SQL but if you were executing normal SQL statement like
ResultSet rs = statement.executeQuery( stmt.toString() );

then obviously you would
rs.Close() before exiting the method in which the executeQuery code is executed

Martin-
----- Original Message ----- From: "vsukumar" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, October 04, 2005 8:50 PM
Subject: [castor-user] ResultSet Open when using db.create . Please help


Hi All,
I am using JBoss 3.2.6 to provide the JNDI for castor to use and I use the
following code to create a object

Database db = null;
      try
      {
          db = jdo.getDatabase();
          db.begin();

          long sessionLogJdoId = 0L;

     db.create(pSessionLogJdo);

      sessionLogJdoId = pSessionLogJdo.getSlId();

db.commit();
      }
      catch(PersistenceException pe)
      {
          logOutput.error("Persistence error", pe);
      }
      finally
      {
     try
      {
          if(db != null)
              db.close();
      }
      catch(PersistenceException pe)
      {
          logOutput.error("error closing database connection",
pe);
     }
     }

And I get the following exception when I turn on the track statements flag
in JBoss. Am I missing something here ?.

Any help would be greatly appreciated.

17:36:17,995 WARN  [WrappedConnection] Closing a result set you left open!
Please close it yourself.
java.lang.Exception: STACKTRACE
      at

org.jboss.resource.adapter.jdbc.WrappedStatement.registerResultSet(WrappedSt
atement.java:852)
      at

org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(Wrappe
dPreparedStatement.java:315)
      at

org.exolab.castor.jdo.drivers.SequenceKeyGenerator.generateKey(SequenceKeyGe
nerator.java:200)
      at
org.exolab.castor.jdo.engine.SQLEngine.generateKey(SQLEngine.java:500)
at org.exolab.castor.jdo.engine.SQLEngine.create(SQLEngine.java:636)
      at
org.exolab.castor.persist.ClassMolder.create(ClassMolder.java:923)
      at org.exolab.castor.persist.LockEngine.create(LockEngine.java:494)
      at

org.exolab.castor.persist.TransactionContext.create(TransactionContext.java:
941)
      at
org.exolab.castor.jdo.engine.DatabaseImpl.create(DatabaseImpl.java:380)
at com.PCPgo.prm.web.audit.AuditDB.createSessionLog(AuditDB.java:47)

Thanks

Vijay



-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------



-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------




-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------



-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to