aspose file tools*
The moose likes Object Relational Mapping and the fly likes double-entries in table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "double-entries in table" Watch "double-entries in table" New topic
Author

double-entries in table

Marshall Levin
Greenhorn

Joined: Nov 29, 2004
Posts: 4
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

Joined: Jan 10, 2002
Posts: 61426
    
  67

"ML", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Marshall Levin
Greenhorn

Joined: Nov 29, 2004
Posts: 4
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

Joined: Nov 29, 2004
Posts: 4
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 :-)
 
Don't get me started about those stupid light bulbs.
 
subject: double-entries in table