This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 206288 - com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry 'CTN0084090' for key 'PRIMARY'
Summary: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplica...
Status: RESOLVED INCOMPLETE
Alias: None
Product: db
Classification: Unclassified
Component: MySQL (show other bugs)
Version: 7.0.1
Hardware: Other Windows 7
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-12 19:24 UTC by allenkoijam
Modified: 2011-12-13 18:04 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description allenkoijam 2011-12-12 19:24:03 UTC
Hi Team,

I have a frame form designed in netbean 7.0.1 in which i have display few fields after doing a search based on some ID.I also have a button "NEXT" and "PREVIOUS" to move the records. by clicking these two buttons i can see the data one after the ottherr. i too have another button "update" where i can update the data, for which an update sql is fired. updates works fine for the first record, but if the next button or the previous button is clicked and try to update the record,:
com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry 'CTN0084090' for key 'PRIMARY' is shown. When i take the same sql and executed in the mysql console it works fine. Please helpe me on this.

THis is really critical for me as we are in a critical situation for the deliver of the product to clients. I guess this is a bug in the netbean after seeing few comments.

Please help me out.


Thanks,
Allenkoijam
Comment 1 Jiri Rechtacek 2011-12-12 19:47:00 UTC
Hi, I'm afraid I can help because a lack of details about your problem. See my questions below:

(In reply to comment #0)
> I have a frame form designed in netbean 7.0.1
What template did you use for designing your application?
> in which i have display few
> fields after doing a search based on some ID.I also have a button "NEXT" and
> "PREVIOUS" to move the records. by clicking these two buttons i can see the
> data one after the ottherr. i too have another button "update" where i can
> update the data, for which an update sql is fired. updates works fine for the
> first record, but if the next button or the previous button is clicked and try
> to update the record,:
> com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate
> entry 'CTN0084090' for key 'PRIMARY' is shown.
> When i take the same sql and
Could you post the sql? 
> executed in the mysql console it works fine. Please helpe me on this.
For best investigating would be a snippet of your class or whole app if possible.

> THis is really critical for me as we are in a critical situation for the
> deliver of the product to clients. I guess this is a bug in the netbean after
> seeing few comments.
I cannot confirm yours guess so far.

Regards.

> 
> Please help me out.
> 
> 
> Thanks,
> Allenkoijam
Comment 2 allenkoijam 2011-12-13 18:04:03 UTC
Hi please find my inputs below against ur queries.


What template did you use for designing your application?
<
I use jframe to design my forms where i am putting all my components like textbox, combo, label etc.
>
Could you post the sql? 
<

UPDATE  ELECTOR_MASTER_TABLE SET VOTER_ID=?,ELECTOR_NAME=?,SUR_NAME=?,FATHER_NAME=?,SEX=?,AGE=?,ADDRESS=?,TEHSIL=?,DISTRICT=?,PIN=?,DATE=STR_TO_DATE(?,'%Y-%m-%d'),HOUSE_NO=?,WARD_NO=?,POLLING_NO=?,CONSTITUENCY=?,CONTACT_NO=?,IS_LEADER =?,CANDIDATE =?,LEADER=?,HUSBAND_NAME=?,PANCHAYAT=? WHERE VOTER_ID=?;
>

For best investigating would be a snippet of your class or whole app if
possible.
<

// handler for update button.
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                         
     
    String fnName="[UpdateVoterForm.jButton3ActionPerformed]";
    GoElectionApp.infoLogger.info(fnName+":Entering:"+fnName);
    String action=null;
    boolean result=false;
    VoterBean voterobj= new VoterBean();
    CommonAction actionObj=null;
    
      voterobj.setVoterId(jTextField8.getText());
      voterobj.setSurName(jTextField9.getText());
      voterobj.setVoterName(jTextField10.getText());
      voterobj.setFatherName(jTextField11.getText());
      voterobj.setSex((String)jComboBox2.getSelectedItem()); 
      voterobj.setDob(jTextField12.getText());
      voterobj.setAddress(jTextField13.getText());
      voterobj.setTehshil(jTextField14.getText());
      voterobj.setDistrict(jTextField15.getText());
      voterobj.setmDate(jTextField16.getText());
      voterobj.setPin(jTextField17.getText());
      voterobj.setWardNo(jTextField18.getText());
      voterobj.setHouseNo(jTextField19.getText());
      voterobj.setPollingNo(jTextField20.getText());
      voterobj.setConstituency(jTextField21.getText());
      voterobj.setHusbandName(jTextField23.getText());
      voterobj.setPanchayat(jTextField24.getText());
      voterobj.setContactNo(jTextField22.getText());
      voterobj.setIsLeader((String)jComboBox3.getSelectedItem());
      voterobj.setCandidate((String)jComboBox4.getSelectedItem());
      voterobj.setLeader((String)jComboBox5.getSelectedItem());
      voterobj.setOldVoterid(getvoterId());
     action=AppConstants.ACTION_EDIT_VOTER;
    try{
        if(actionObj==null){
            actionObj= new CommonAction();
        }
   result=  actionObj.process(action,voterobj);
    }
    catch(Exception ex){
       GoElectionApp.errorLogger.error("Error accured at :"+fnName+ex);
    
    }
     if(result){
        DialogBox.displayDialogBox(CommonUtil.getProperty("INFO"),CommonUtil.getProperty("DATA_SAVE_SUCCESS"));
        jTextField8.setText("");
        jTextField9.setText("");
        jTextField10.setText("");
        jTextField11.setText("");
        jTextField12.setText("");
        jTextField13.setText("");
        jTextField14.setText("");
        jTextField15.setText("");
        jTextField16.setText("");
        jTextField17.setText("");
        jTextField18.setText("");
        jTextField19.setText("");
        jTextField20.setText("");
        jTextField21.setText("");
        jTextField22.setText("");
        jTextField23.setText("");
        jTextField24.setText("");
        jTextField25.setText("");
        
       }
    else{
         DialogBox.displayDialogBox(CommonUtil.getProperty("ERROR"),CommonUtil.getProperty("DATA_SAVE_FAILURE"));
        GoElectionApp.errorLogger.error("Error..failed to save data due to some internal error");
    }
    
}     


>

> THis is really critical for me as we are in a critical situation for the
> deliver of the product to clients. I guess this is a bug in the netbean after
> seeing few comments.
I cannot confirm yours guess so far.


Regards,
Allenkoijam