-
1. Re: about rowset
ipozeng Feb 28, 2002 7:47 PM (in response to ipozeng)Now i really know why the CachedRowSet cannot be used in CMT bean by using jad tool.The following is code snippet produced by jad:
...
public boolean writeData(RowSetInternal rowsetinternal)
throws SQLException
{
boolean flag = false;
boolean flag1 = false;
PreparedStatement preparedstatement = null;
CachedRowSet cachedrowset = (CachedRowSet)rowsetinternal;
con = ((RowSetReaderImpl)cachedrowset.getReader()).connect(rowsetinternal);
if(con == null)
throw new SQLException("Unable to get Connection");
if(con.getAutoCommit())
con.setAutoCommit(false);
con.setTransactionIsolation(cachedrowset.getTransactionIsolation());
initSQLStatements(cachedrowset);
preparedstatement = con.prepareStatement(insertCmd);
if(callerColumnCount < 1)
{
if(((RowSetReaderImpl)cachedrowset.getReader()).getCloseConnection())
con.close();
return true;
}
flag1 = cachedrowset.getShowDeleted();
cachedrowset.setShowDeleted(true);
cachedrowset.beforeFirst();
while(cachedrowset.next())
if((!cachedrowset.rowDeleted() || !cachedrowset.rowInserted()) &&
(cachedrowset.rowDeleted() ? (flag = deleteOriginalRow(cachedrowset)) :
cachedrowset.rowInserted() ?
(flag = insertNewRow(cachedrowset, preparedstatement)) :
cachedrowset.rowUpdated() && (flag = updateOriginalRow(cachedrowset))))
break;
preparedstatement.close();
cachedrowset.setShowDeleted(flag1);
if(flag)
{
con.rollback(); <----- donot allowed using CMT
if(((RowSetReaderImpl)cachedrowset.getReader()).getCloseConnection())
con.close();
return false;
}
con.commit(); <----- donot allowed using CMT
if(((RowSetReaderImpl)cachedrowset.getReader()).getCloseConnection())
con.close();
return true;
}
....
By comment the commit and rollback call it works great when using CMT
jad is a wonderful tool however i am uncomfortable because i feel it is so easy to decompile class file
Moreover since sun doesnot prevent it from decompiling by obfuscating it why doesnot sun make it open source ?
BTW,when compiling the jad output you must make jboss-jdbc_ext.jar,xerces.jar be in classpath.For me i still cannot compile WebRowSet.java and Xml*.java as i cannot find out which jar file contains com.sun.xml.parser.* classes. -
2. Re: about rowset
zeroman Mar 1, 2002 11:02 AM (in response to ipozeng)It seems to me what you are not use RowSet properly.
I mean acceptChanges()? try to remove it.
It must work because we use this library in the project and everything work fine in the EJB. -
3. Re: about rowset
ipozeng Mar 3, 2002 10:46 PM (in response to ipozeng)>> mean acceptChanges()? try to remove it.
If so how do i update the underlying data?
Regards!