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 Json v1.0
  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
Character String Indexes
Kit Kennedy
2013-10-08 14:29:02
I need some help with a problem that we are experiencing. Up until now, we have only been testing with your DBF driver. I have not had any issues recently and it has worked great, but then we had this problem:
There are two applications/drivers that will be accessing the data.
1. Our current ERP system accesses the system and displays and processes data to administration users.
2. The new applications that I've written for our production operations that will use your DBF driver to send and receive data to/from the database tables.

We have 2 tables that each have primary key IDs as integers. One of these tables also has a reference field back to the other table's ID field.

PartEvent
-----------
int ID
varchar eventNotes
... other fields

PartEventData
---------------
int ID
int PartEventRef
varchar dataValue
... other fields

The Following code is for each of these tables:

@Entity
@Table(name = "zPRTEVT")
public class PartEvent implements Serializable {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID", nullable = false)
private Integer id;
@Basic(optional = true)
@Column(name = "NOTES", nullable = true, length = 254)
private String notes;
...

@Entity
@Table(name = "zPTEDATA")
public class PartEventData implements Serializable {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID", nullable = false)
private Integer id;
@Basic(optional = false)
@Column(name = "DATAVALUE", nullable = true, length = 254)
private String dataValue;
@JoinColumn(name = "PEVENTREF", referencedColumnName = "ID", nullable = false)
@ManyToOne(optional = false)
private PartEvent partEventRef;
...

The following code is for persisting new data into these tables:
// Create a new part event record
PartEvent newPartEventRef = new PartEvent();
newPartEventRef.setEventDate(date);
newPartEventRef.setEventTypeRef(partEventTypeRef);
newPartEventRef.setNotes(eventNotes);
newPartEventRef.setPartSNRef(partSNRef);
newPartEventRef.setStation(stationRef);
emgr.getTransaction().begin();
emgr.persist(newPartEventRef);
emgr.getTransaction().commit();


PartEventData eventDataRef = new PartEventData();
eventDataRef.setDataValue(data.getDataValue());
eventDataRef.setPartEventRef(partEventRef);
emgr.getTransaction().begin();
emgr.persist(eventDataRef);
emgr.getTransaction().commit();


Here is the problem:
Our ERP system requires that indexes be varchar, not integers.
Is there any way to have 2 indexes against this primary key ID field? One index be the integer primary key index and the other be the varchar index. I realize this may sound strange and if you need more information, please ask.
Thank you for any help that you are able to offer.
Re:Character String Indexes
HXTT Support
2013-10-08 18:37:29
>Our ERP system requires that indexes be varchar, not integers.
It's visiting that table through ODBC? If both system are modifing data at the same time, you need lockType=VFP connection property.

>Is there any way to have 2 indexes against this primary key ID field? One index be the integer primary key index and the other be the varchar index.
An ID index expression can't be integer type and varchar type at the same time, you can use ID and STR(ID) as index expression.

Maybe one solution is to modify your ID column as a varchar type, since HXTT DBF allow varchar and integer convertion automatically.

Re:Re:Character String Indexes
Kit Kennedy
2013-10-09 04:01:53
The problem is that the Id field was not autoincrementing when even a second separate character index was pointing to the field. The entry was entered but with Id =0.
Re:Re:Re:Character String Indexes
HXTT Support
2013-10-09 05:40:11
>The problem is that the Id field was not autoincrementing when even a second separate character index was pointing to the field.
Because An int type is not autoincrementing, but you can use int AUTO_INCREMENT type if your dabase format is VFP. For instance, backup yourTable first, then run "alter table yourTable modify id int AUTO_INCREMENT;"

>@GeneratedValue(strategy = GenerationType.IDENTITY)
You can try @GeneratedValue(strategy = GenerationType.SEQUENCE) too.

Re:Re:Re:Re:Character String Indexes
Kit Kennedy
2013-10-09 05:43:02
But it was autoincrementing when the field is set to integer, but not when there is an index pointing to it set as a varchar.
I want to keep strategy = GenerationType.IDENTITY.
I believe this is what is correct for what I'm doing.
Re:Re:Re:Re:Re:Character String Indexes
HXTT Support
2013-10-09 05:51:58
>But it was autoincrementing when the field is set to integer, but not when there is an index pointing to it set as a varchar.
Which set an int AUTO_INCREMENT type as a varchar type?
Re:Re:Re:Re:Re:Re:Character String Indexes
Kit Kennedy
2013-10-09 05:56:58
I might be able to explain better with pictures, could I send you an email with attachments? What email address should I use?

The ID field was autoincrementing properly when the field was an integer and if I were to set it to varchar (I assume) it would not autoincrement. With indexes that are varchar pointing to those fields, the ID field stops autoincrementing.
Re:Re:Re:Re:Re:Re:Re:Character String Indexes
HXTT Support
2013-10-09 06:04:09
You can use support @ hxtt.com . If possible, you can send us a database sample.
Re:Re:Re:Re:Re:Re:Re:Re:Character String Indexes
Rick Scott
2013-10-09 06:33:34
My associate (Charles Schilling) is going to send you a sample of the table with the compound indexes.

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