JDK : jdk1.6 -b46
Platform[s] : Sol 10
switch/Mode : default
DB : orcl
Description:
===========
The total number of rows didn't retrun correctly after some rows had been deleted.
How to reproduce:
====================
javac try_test.java
java try_test
Test output:
=============
Calling doSetup() of the Test ...
Calling doTest() of the Test ...
Calling QueryObjectFactory.createDefaultQueryObject()
Got QueryObject handle
Calling getAllPersons() :
Got DataSet. size=3
Queried Result: 1,Sun,Java,39
Queried Result: 2,Java,Crazy,36
Queried Result: 3,Easy,Java,38
Removing the Row with this ID: 2
Removing the Row with this ID: 3
query size is 3
Queried Result Again: 1,Sun,Java,39
Exception in thread "main" java.util.NoSuchElementException
at java.util.AbstractList$Itr.next(AbstractList.java:427)
at com.sun.sql.DataSetImpl$DataSetItr.next(Unknown Source)
at try_test.doTest(try_test.java:87)
at try_test.main(try_test.java:122)
try_test.java
===================
import com.sun.rowset.CachedRowSetImpl;
import java.io.File;
import java.util.*;
import java.sql.*;
import javax.sql.rowset.*;
import javax.sql.rowset.CachedRowSet.*;
public class try_test {
Connection conn = null;
Statement stmt = null;
private void doSetup() {
try {
Class.forName("com.inet.ora.OraDriver");
}catch (ClassNotFoundException ex) {
System.err.println("Exception when loading JDBC driver : "+ex);
}
try {
conn = DriverManager.getConnection("jdbc:inetora:10.5.21.11:1521:ORCL", "jdbc_user9", "jdbc_user9");
stmt = conn.createStatement();
}catch (SQLException ex) {
System.err.println("Exception : "+ex);
}
try {
stmt.execute("delete from eod_column_table");
stmt.execute("drop table eod_column_table");
}catch (SQLException sqlEx) { }
try {
stmt.execute("create table eod_column_table ( id number, firstName varchar2(32), lastName varchar2(32), age int)");
stmt.execute("insert into eod_column_table values ( 1, 'Sun', 'Java', 39)");
stmt.execute("insert into eod_column_table values ( 2, 'Java', 'Crazy', 36)");
stmt.execute("insert into eod_column_table values ( 3, 'Easy', 'Java', 38)");
}catch (SQLException ex) {
System.err.println("Exception when executing SQL :"+ex);
}
}
private void doTest() {
I_QueryTest query = null;
DataSet<eod_column_dataSet> rows = null;
String record;
boolean Status = false;
try {
System.out.println("Calling QueryObjectFactory.createDefaultQueryObject()");
query = QueryObjectFactory.createDefaultQueryObject(I_QueryTest.class, conn);
System.out.println("Got QueryObject handle ");
} catch (SQLException sqlEx) {
System.err.println("SQLException caught "+sqlEx.getMessage());
}
try {
System.out.println("Calling getAllPersons() : ");
rows = query.getEodColumnTable();
System.out.println("Got DataSet. size="+rows.size());
}catch (Exception ex) {
System.out.println("Exception :"+ex.getMessage());
}
record = "";
for (eod_column_dataSet c: rows) {
record=c.id +"," + c.firstName +"," + c.lastName + "," + c.age;
System.out.println("Queried Result: " + record);
}
try {
conn.close();
for (eod_column_dataSet c: rows){
if (c.id == 2 || c.id == 3) {
System.out.println("Removing the Row with this ID: " + c.id);
rows.delete();
}
}
System.out.println("query size is " +rows.size());
for (eod_column_dataSet c: rows) {
record=c.id +"," + c.firstName +"," + c.lastName + "," + c.age;
System.out.println("Queried Result Again: " + record);
}
}catch (SQLException ex){
System.out.println("expection: " + ex.getMessage());
}
System.out.println("TEST is: " + Status);
}
public static void main(String[] args) {
try_test qtest = new try_test();
System.out.println("Calling doSetup() of the Test ...");
qtest.doSetup();
System.out.println("Calling doTest() of the Test ...");
qtest.doTest();
System.out.println("Finished calling doSetup() of the Test ");
}
}
interface I_QueryTest extends BaseQuery {
@Query(sql="select * from eod_column_table", readOnly=false, connected=false)
DataSet<eod_column_dataSet> getEodColumnTable() throws SQLException;
}
eod_update_dataSet.java
============================
import java.sql.*;
//@Table(name="newDataSetTable")
public class eod_column_dataSet{
@Column int id;
@Column String firstName;
@Column String lastName;
@Column int age;
}
Platform[s] : Sol 10
switch/Mode : default
DB : orcl
Description:
===========
The total number of rows didn't retrun correctly after some rows had been deleted.
How to reproduce:
====================
javac try_test.java
java try_test
Test output:
=============
Calling doSetup() of the Test ...
Calling doTest() of the Test ...
Calling QueryObjectFactory.createDefaultQueryObject()
Got QueryObject handle
Calling getAllPersons() :
Got DataSet. size=3
Queried Result: 1,Sun,Java,39
Queried Result: 2,Java,Crazy,36
Queried Result: 3,Easy,Java,38
Removing the Row with this ID: 2
Removing the Row with this ID: 3
query size is 3
Queried Result Again: 1,Sun,Java,39
Exception in thread "main" java.util.NoSuchElementException
at java.util.AbstractList$Itr.next(AbstractList.java:427)
at com.sun.sql.DataSetImpl$DataSetItr.next(Unknown Source)
at try_test.doTest(try_test.java:87)
at try_test.main(try_test.java:122)
try_test.java
===================
import com.sun.rowset.CachedRowSetImpl;
import java.io.File;
import java.util.*;
import java.sql.*;
import javax.sql.rowset.*;
import javax.sql.rowset.CachedRowSet.*;
public class try_test {
Connection conn = null;
Statement stmt = null;
private void doSetup() {
try {
Class.forName("com.inet.ora.OraDriver");
}catch (ClassNotFoundException ex) {
System.err.println("Exception when loading JDBC driver : "+ex);
}
try {
conn = DriverManager.getConnection("jdbc:inetora:10.5.21.11:1521:ORCL", "jdbc_user9", "jdbc_user9");
stmt = conn.createStatement();
}catch (SQLException ex) {
System.err.println("Exception : "+ex);
}
try {
stmt.execute("delete from eod_column_table");
stmt.execute("drop table eod_column_table");
}catch (SQLException sqlEx) { }
try {
stmt.execute("create table eod_column_table ( id number, firstName varchar2(32), lastName varchar2(32), age int)");
stmt.execute("insert into eod_column_table values ( 1, 'Sun', 'Java', 39)");
stmt.execute("insert into eod_column_table values ( 2, 'Java', 'Crazy', 36)");
stmt.execute("insert into eod_column_table values ( 3, 'Easy', 'Java', 38)");
}catch (SQLException ex) {
System.err.println("Exception when executing SQL :"+ex);
}
}
private void doTest() {
I_QueryTest query = null;
DataSet<eod_column_dataSet> rows = null;
String record;
boolean Status = false;
try {
System.out.println("Calling QueryObjectFactory.createDefaultQueryObject()");
query = QueryObjectFactory.createDefaultQueryObject(I_QueryTest.class, conn);
System.out.println("Got QueryObject handle ");
} catch (SQLException sqlEx) {
System.err.println("SQLException caught "+sqlEx.getMessage());
}
try {
System.out.println("Calling getAllPersons() : ");
rows = query.getEodColumnTable();
System.out.println("Got DataSet. size="+rows.size());
}catch (Exception ex) {
System.out.println("Exception :"+ex.getMessage());
}
record = "";
for (eod_column_dataSet c: rows) {
record=c.id +"," + c.firstName +"," + c.lastName + "," + c.age;
System.out.println("Queried Result: " + record);
}
try {
conn.close();
for (eod_column_dataSet c: rows){
if (c.id == 2 || c.id == 3) {
System.out.println("Removing the Row with this ID: " + c.id);
rows.delete();
}
}
System.out.println("query size is " +rows.size());
for (eod_column_dataSet c: rows) {
record=c.id +"," + c.firstName +"," + c.lastName + "," + c.age;
System.out.println("Queried Result Again: " + record);
}
}catch (SQLException ex){
System.out.println("expection: " + ex.getMessage());
}
System.out.println("TEST is: " + Status);
}
public static void main(String[] args) {
try_test qtest = new try_test();
System.out.println("Calling doSetup() of the Test ...");
qtest.doSetup();
System.out.println("Calling doTest() of the Test ...");
qtest.doTest();
System.out.println("Finished calling doSetup() of the Test ");
}
}
interface I_QueryTest extends BaseQuery {
@Query(sql="select * from eod_column_table", readOnly=false, connected=false)
DataSet<eod_column_dataSet> getEodColumnTable() throws SQLException;
}
eod_update_dataSet.java
============================
import java.sql.*;
//@Table(name="newDataSetTable")
public class eod_column_dataSet{
@Column int id;
@Column String firstName;
@Column String lastName;
@Column int age;
}