• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

double-entries in table

 
Marshall Levin
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm stumped by a JPA issue. I have a simple timesheet application.

I have a class Timesheet and a class TimesheetRow, which contains the detail. I've omitted some details, but here's the basic structure:



I've got MySQL tables like this:



Then I've got some JPA code like this:



I am getting entries in the timesheet table and associated entries in the timesheet_detail table, but I seem to be getting additional "dummy" entries in the timesheet table (one with the real data and an additional one with missing data for each timesheet row I have).

So after inserting a timesheet with one timesheet row, I have data like this:



What the heck am I doing wrong? I'm completely baffled.

Any suggestions would be appreciated!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"ML", please check your private messages for an important administrative matter.
 
Marshall Levin
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should mention that it's the "new timesheet" path that is giving me trouble (when an existing one isn't found) -- I haven't even gotten to the other path yet.

Also, in case it was not obvious, my database examples are just dumps of MySQL, so the "insert" statements are just to show what rows I'm ending up with.
 
Marshall Levin
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I managed to solve my own problem. I remembered that MyEclipse has a JPA reverse-engineering function, so I just pointed it at my tables :-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic