Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access 7.1.254
  HXTT Cobol 5.0.253
  HXTT DBF 7.1.254
  Buy Now
  HXTT Excel 6.1.257
  HXTT Json 1.0.225
  HXTT Paradox 7.1.253
  HXTT PDF 2.0.253
  HXTT Text(CSV) 7.1.253
  HXTT Word 1.1.253
  HXTT XML 4.0.254
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)

Duplicate on Primary Key
2013-04-23 14:06:55
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
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
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
>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
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
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 © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Refund | Sitemap