Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v7.1
  HXTT Cobol v5.0
  HXTT DBF v7.1
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v6.1
  HXTT Paradox v7.1
  HXTT PDF v2.0
  HXTT Text(CSV) v7.1
  HXTT Word v1.1
  HXTT XML v4.0
Offshore Outsourcing
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Heng Xing Tian Tai Lab of Xi'an City (abbr, HXTT)

HXTT DBF
Hibernate select issues
Mantas Karpicius
2020-02-20 04:27:31.0
Hi, we've recently purchased a license for the DBF driver and it has been working great. Yet, we have encountered an issue and were wondering if you have encountered this same issue before. We're using the hibernate support package for Hibernate version from 5.0 to 5.2.X, with Hibernate 5.2.18 and it seems that after querying Select -> Insert -> Select, the second select returns the same results as the first one. Any help would be greatly appreciated!
Re:Hibernate select issues
HXTT Support
2020-02-20 05:51:11.0
1st possible occasion:
query it from a connection, insert a row(but is using transaction), not commit.
query it from another connection, can't see it.


package test.jdbc.dbf;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
* Sample program that shows insert statement is not committed when transaction
* isolation is set to TRANSACTION_READ_COMMITTED
*
*/
public class DBFTestTrans1 {

public static void main(String[] args) throws Exception {
String user = "";
String password = "";
String url = "jdbc:dbf:////d:/test/dbf";
String driver = "com.hxtt.sql.dbf.DBFDriver";

Class.forName(driver);

Connection connection = DriverManager.getConnection(url, user, password);
connection.setAutoCommit(true); // when following line is commented out it works!
connection.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);

Statement statement = connection.createStatement();
if (false) {//init database
statement.execute("drop table if exists tst;create table if not exists tst (x integer);create index a on tst (x)");
// statement.execute("create table if not exists tst (x integer)");
statement.close();
}

ResultSet rs = statement.executeQuery("select recno(),x from tst where x=1");
int count = 0;
while (rs.next()) {
System.out.println(rs.getInt(1));
count++;
}
System.out.println("read " + count + " record(s)");

statement = connection.createStatement();
statement.executeUpdate("insert into tst (x) values (1)");


// connection.commit();
// connection.close();
// connection = DriverManager.getConnection(url, user, password);
rs = statement.executeQuery("select recno(),x from tst where x=1");
count = 0;
while (rs.next()) {
System.out.println(rs.getInt(1));
count++;
}
System.out.println("read " + count + " record(s)");

{
Connection anotherConnection = DriverManager.getConnection(url, user, password);
Statement anotherStatement = anotherConnection.createStatement();
rs = anotherStatement.executeQuery("select recno(),x from tst where x=1");
count = 0;
while (rs.next()) {
System.out.println(rs.getInt(1));
count++;
}
System.out.println("read " + count + " record(s)");
anotherConnection.close();

}

statement.close();

//connection.commit();
connection.close();
}
}

Re:Re:Hibernate select issues
Mantas Karpicius
2020-02-21 07:41:41.0
Thank you for the quick response! Using direct separate JDBC connections, (that are closed after the query is finished), for the queries, everything works correctly. Yet, if we use hibernate for these operations, the second select returns the same result as the first one. Could you provide a working sample or some assistance with the configuration of hibernate using this driver/dBase?
Thank you once again!
Re:Re:Re:Hibernate select issues
HXTT Support
2020-02-22 03:19:28.0
Please download the latest package. Your issue should disappear.

Search Key   Search by Last 50 Questions




Google
 

Email: webmaster@hxtt.com
Copyright © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Sitemap