Both my tables are bound to their respective JTables. I have the entitymanager and all the other stuff.
I can insert into tables, but when I try to delete a record, it comes back to say that the record cannot be found or does not exist. Here's my code:
try
{
JOptionPane.showMessageDialog(null, "It's over? What A Shame....");
String GID = JOptionPane.showInputDialog("Enter Game Code:");
int GameID = Integer.parseInt(GID);
//Finding Game
Roster r = PATMiniPUEntityManager.find(Roster.class, GameID);
//Deleting
PATMiniPUEntityManager.getTransaction().begin();
PATMiniPUEntityManager.remove(r);
PATMiniPUEntityManager.getTransaction().commit();
System.out.println("Deleted!");
}
catch(Exception exc)
{
System.out.println("No Game Found!");
}
I cannot find the error anywhere. The PK in the table is of type Integer.