title: Duplicate primary key validation
body: <p>I am building a java project. I want to check if a primary key already exist in my table. For example I have the below code:</p>
  
  <pre><code>private void AddProductActionPerformed(java.awt.event.ActionEvent evt) 
  {                                           
      String query="INSERT INTO Products(Pro_Id ,Pro_Name,Pro_Price,Pro_Quantity,Pro_Supplier_id)VALUES ('"+Pro_Id.getText()+" ','"+Pro_Name.getText()+" ','"+Pro_Price.getText()+" ','"+Pro_Quantity.getText()+" ','"+Pro_Supplier_id.getText()+" ') ";
      executeSQLQuery(query,"Inserted");
  } 
  </code></pre>
  
  <p>How can I  get a message that tells me to change the entry of primary key if it already exists?</p>