Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Primary key violation

 
Isaac Ferguson
Ranch Hand
Posts: 841
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am trying to insert data from a .data file to a database it works the first time but after that it launches an error like



The code is like



Any idea, please?

Thanks
 
Winston Gutkowski
Bartender
Pie
Posts: 10417
63
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Angus Ferguson wrote:I am trying to insert data from a .data file to a database it works the first time but after that it launches an error like
...
Any idea, please?

I'm afraid my Spanish(?) isn't very good, but why are you trying to apply your .data file more than once?

I suspect it's simply telling you that you're trying to add the same data more than once.
And isn't that a good thing?

Winston
 
Isaac Ferguson
Ranch Hand
Posts: 841
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

the exception in english is



But I don´t why it happens

Any idea?

Thanks
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My idea is, you should go down the stack trace into the part you didn't show us, until you find a line which refers to your code. It will tell you the line number in your code. Start looking there.
 
Winston Gutkowski
Bartender
Pie
Posts: 10417
63
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Angus Ferguson wrote:But I don´t why it happens...

And I say again: Aren't you you're trying to add the same data (or perhaps the same key) more than once?

Winston
 
Wei Dai
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should add one line to check the latest insert rows too.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic