JDK : jdk1.6-b46
Platform[s] : Sol 10 sparc
switch/Mode : Default
DB : ORCL
Description:
===========
After the rows had been deleted from a @Query DataSet connection=false and DataSet.sync() to the DataBase, the expected rows still exits in DB.
Test:
=====
java_sql_eod/column/Column003_name_004
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: 1
Removing the Row with this ID: 2
query size is 3
Queried DB before sync and after delete 1,Sun,Java,39
Queried DB before sync and after delete 2,Java,Crazy,36
Queried DB before sync and after delete 3,Easy,Java,38
sync() is called
Queried DB after sync: 2,Java,Crazy,36
Queried DB after sync: 3,Easy,Java,38
Finished calling doSetup() of the Test
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.*;
interface I_QueryTest extends BaseQuery {
@Query(sql="select * from eod_column_table", readOnly=false, connected=false)
DataSet<eod_column_dataSet> getEodColumnTable() throws SQLException;
@Query(sql="select * from eod_column_table")
DataSet<eod_column_dataSet> getAll() throws SQLException;
}
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:[your db ip]:1521:ORCL", "user", "pass");
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() {
String record;
boolean Status = false;
try {
conn.close();
conn = DriverManager.getConnection("jdbc:inetora:[your db ip]:1521:ORCL", "user", "pass");
System.out.println("Calling QueryObjectFactory.createDefaultQueryObject()");
I_QueryTest query = QueryObjectFactory.createDefaultQueryObject(I_QueryTest.class, conn);
System.out.println("Got QueryObject handle ");
System.out.println("Calling getAllPersons() : ");
DataSet<eod_column_dataSet> rows = query.getEodColumnTable();
System.out.println("Got DataSet. size="+rows.size());
record = "";
for (eod_column_dataSet c: rows) {
record=c.id +"," + c.firstName +"," + c.lastName + "," + c.age;
System.out.println("Queried Result: " + record);
}
for (eod_column_dataSet c: rows){
//if (c.id == 2 || c.id == 3)
if (c.age == 36 || c.age == 39){
System.out.println("Removing the Row with this ID: " + c.id);
rows.delete();
}
}
System.out.println("query size is " +rows.size());
record="";
DataSet<eod_column_dataSet> rows2 = query.getAll();
for (eod_column_dataSet c: rows2) {
record=c.id +"," + c.firstName +"," + c.lastName + "," + c.age;
System.out.println("Queried DB before sync and after delete " + record);
}
System.out.println("sync() is called");
rows.sync(conn);
record="";
rows2 = query.getAll();
for (eod_column_dataSet c: rows2) {
record=c.id +"," + c.firstName +"," + c.lastName + "," + c.age;
System.out.println("Queried DB after sync: " + 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 ");
}
}
eod_column_dataSet.java
========================
import java.sql.*;
@Table(name="eod_column_table")
public class eod_column_dataSet{
int id;
String firstName;
String lastName;
int age;
}
Platform[s] : Sol 10 sparc
switch/Mode : Default
DB : ORCL
Description:
===========
After the rows had been deleted from a @Query DataSet connection=false and DataSet.sync() to the DataBase, the expected rows still exits in DB.
Test:
=====
java_sql_eod/column/Column003_name_004
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: 1
Removing the Row with this ID: 2
query size is 3
Queried DB before sync and after delete 1,Sun,Java,39
Queried DB before sync and after delete 2,Java,Crazy,36
Queried DB before sync and after delete 3,Easy,Java,38
sync() is called
Queried DB after sync: 2,Java,Crazy,36
Queried DB after sync: 3,Easy,Java,38
Finished calling doSetup() of the Test
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.*;
interface I_QueryTest extends BaseQuery {
@Query(sql="select * from eod_column_table", readOnly=false, connected=false)
DataSet<eod_column_dataSet> getEodColumnTable() throws SQLException;
@Query(sql="select * from eod_column_table")
DataSet<eod_column_dataSet> getAll() throws SQLException;
}
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:[your db ip]:1521:ORCL", "user", "pass");
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() {
String record;
boolean Status = false;
try {
conn.close();
conn = DriverManager.getConnection("jdbc:inetora:[your db ip]:1521:ORCL", "user", "pass");
System.out.println("Calling QueryObjectFactory.createDefaultQueryObject()");
I_QueryTest query = QueryObjectFactory.createDefaultQueryObject(I_QueryTest.class, conn);
System.out.println("Got QueryObject handle ");
System.out.println("Calling getAllPersons() : ");
DataSet<eod_column_dataSet> rows = query.getEodColumnTable();
System.out.println("Got DataSet. size="+rows.size());
record = "";
for (eod_column_dataSet c: rows) {
record=c.id +"," + c.firstName +"," + c.lastName + "," + c.age;
System.out.println("Queried Result: " + record);
}
for (eod_column_dataSet c: rows){
//if (c.id == 2 || c.id == 3)
if (c.age == 36 || c.age == 39){
System.out.println("Removing the Row with this ID: " + c.id);
rows.delete();
}
}
System.out.println("query size is " +rows.size());
record="";
DataSet<eod_column_dataSet> rows2 = query.getAll();
for (eod_column_dataSet c: rows2) {
record=c.id +"," + c.firstName +"," + c.lastName + "," + c.age;
System.out.println("Queried DB before sync and after delete " + record);
}
System.out.println("sync() is called");
rows.sync(conn);
record="";
rows2 = query.getAll();
for (eod_column_dataSet c: rows2) {
record=c.id +"," + c.firstName +"," + c.lastName + "," + c.age;
System.out.println("Queried DB after sync: " + 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 ");
}
}
eod_column_dataSet.java
========================
import java.sql.*;
@Table(name="eod_column_table")
public class eod_column_dataSet{
int id;
String firstName;
String lastName;
int age;
}