This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Netbeans - Persistence Add Record To Child Table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Netbeans - Persistence Add Record To Child Table" Watch "Netbeans - Persistence Add Record To Child Table" New topic
Author

Netbeans - Persistence Add Record To Child Table

Bill Hayes
Greenhorn

Joined: Sep 24, 2007
Posts: 24
Not sure if this belongs here or in Object Relational Mapping.
I'm working with the gui tools in netbeans to create a java persistence project.
I have two entities, A and B which have a one to many relationship, A being the owner. I have all the relationship stuff taken care of and it works so far.
I have Jframe with a master table, displaying records from A. The table is bound to a list which gets its results from a persistence query from an entity manager. Then I have a detail table which is bound through the master table's selected element and displays the records from the child table, B.
Now I want to add a record to the child table, B. I understand how to do this on the master table, essentially adding a row to the list that the table is bound to. But my detail table is not bound to a list. Can anyone help me understand how to add a record to the child table?
Thanks.
Bill Hayes
Greenhorn

Joined: Sep 24, 2007
Posts: 24
I think I figured out how to add the record to the child table. At least it seems to work when I query the database from a different tool. Now my problem is that I can't get the child table to refresh. I need to be able to refresh the child table (to see the new record) and also maintain the selections in the master table and also two other child tables.
Bill Hayes
Greenhorn

Joined: Sep 24, 2007
Posts: 24
I've been working on this for about a month and a half with no luck. I am able to add a record to the table as I can go in through a query tool and see the new record. It doesn't appear in my JTable unless I leave the current master record then select that record again. There must be something simple I'm missing.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Netbeans - Persistence Add Record To Child Table
 
Similar Threads
how to find child table names that need to be deleted?
Maintaining user state in a web application
Parent child join query
Problem in updating the values with Hibernate
retaining records after a submit in struts 2