Results 1 to 4 of 4
- 11-18-2008, 03:59 PM #1
Member
- Join Date
- Nov 2008
- Posts
- 4
- Rep Power
- 0
Cannot insert duplicate key row in object
Hi Experts;
I am iterating through a Site Object and using the elements values to populate a solution object.
During the iteration process i do encounter duplicates values in the List and hence the exception below when attempt insert:
Do anyone know how to control these duplication?PHP Code:com.microsoft.sqlserver.jdbc.SQLServerException: Cannot insert duplicate key row in object 'dbo.solutionscustinfo' with unique index 'i1'. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown Source) at com.billing.essensys.ws.ServiceSync.SolutionCustSyncOne(ServiceSync.java:452) at com.billing.essensys.ws.ServiceSync.Run(ServiceSync.java:505) at com.billing.essensys.ws.ServiceSync.main(ServiceSync.java:511)
- 11-18-2008, 08:19 PM #2
Senior Member
- Join Date
- Sep 2008
- Posts
- 564
- Rep Power
- 5
This is more of a database question than Java, but you're the "id" column is unique. You will get a database error if you try to insert 2 entries with the same value in a unique column, for example your "id" having multiple entries with value 1. And if that's not what's happening with your program, then I don't know
- 05-07-2009, 09:27 AM #3
Member
- Join Date
- Mar 2009
- Posts
- 52
- Rep Power
- 0
it is primary key violation problem
- 05-07-2009, 09:43 AM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Similar Threads
-
Counting Duplicate Variables in an Array
By Npcomplete in forum New To JavaReplies: 2Last Post: 10-24-2008, 07:33 PM -
Avoid/Eliminate Duplicate Code
By kicker in forum New To JavaReplies: 6Last Post: 09-11-2008, 04:14 AM -
How to insert java Object in oracle database
By Thilkumar82 in forum Advanced JavaReplies: 9Last Post: 08-13-2008, 11:33 AM -
concate all duplicate line in a file.
By vaskarbasak in forum Advanced JavaReplies: 0Last Post: 06-02-2008, 12:49 PM -
random string are duplicate
By googgoo in forum New To JavaReplies: 3Last Post: 04-03-2008, 10:01 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks