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