Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  HXTT Cobol v2.1
  HXTT DBF v5.2
  Buy Now
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
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 Xin Tian Tai Ltd. of Beijing City (abbr, HXTT)

Duplicate on Primary Key
2013-04-23 14:06:55.0
Using the code below, I was able to create multiple duplicates of the same Station Name, even though the StationName is the primary key.

Code to add data:
Station wmStation = new Station();
wmStation.setStationDesc(station.getFirstName() + " " + station.getLastName());

Entity Class:

package wm.wmdata;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

* @author jeick
@Table(name = "zSTATION")
@NamedQuery(name = "Station.findByPartSerialNumber", query = "SELECT c FROM Station c WHERE c.stationName = :stationName")})
public class Station implements Serializable {

private static final long serialVersionUID = 1L;
@Basic(optional = false)
@Column(name = "STATNAME", nullable = false, length = 50)
private String stationName;
@Basic(optional = false)
@Column(name = "STATDESC", nullable = false, length = 254)
private String stationDesc;

public Station() {

public String getStationName() {
return stationName;

public void setStationName(String stationName) {
this.stationName = stationName;

public String getStationDesc() {
return stationDesc;

public void setStationDesc(String stationDesc) {
this.stationDesc = stationDesc;
Re:Duplicate on Primary Key
HXTT Support
2013-04-23 17:27:10.0
select * from Station group by stationName having count(stationName )>1;
To see whether there's duplicate row.
If it exists, please check whether there's primary key index on stationName.
Re:Re:Duplicate on Primary Key
2013-04-23 17:45:37.0
By having the @Id label on the stationName in the Entity class, shouldn't that identify that column as the primary key?
Re:Re:Re:Duplicate on Primary Key
HXTT Support
2013-04-23 17:57:56.0
>By having the @Id label on the stationName in the Entity class
If you wish to add a primary key for existent table, you need to run once:
CREATE INDEX stationName ON Station (stationName PRIMARY KEY);
Re:Re:Re:Re:Duplicate on Primary Key
2013-05-24 07:51:12.0
Does this apply to Visual FoxPro 9.0, because my VFP admin says that it doesn't need this command. Could you please clarify this for me?
Re:Re:Re:Re:Re:Duplicate on Primary Key
HXTT Support
2013-05-24 17:17:14.0
That sql is only used by HXTT DBF.
You can create a primary key index in VFP 9.0 through VFP command also. Then HXTT DBF can see it.

Search Key   Search by Last 50 Questions


Copyright © 1999-2017 Heng Xin Tian Tai Ltd. of Beijing City. | All Rights Reserved. | Privacy | Legal | Sitemap