• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

double-entries in table

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 67590
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 :-)
 
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic