This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
then when you do a q.list() you will get instances of TableA beans, that contain a nested (joined) TableB, that you can access like
and later when you save
It will save just the tableA, but not the nested TableB
Note also that i used named queries as opposed to building the query string in the code. Unless there is a good reason, like a complete free form dynamic query, I have found it better to use named queries as they are validated when hibernate boots up, as opposed to when they are run, which saves a lot of sanity when you are investigating a mature app and someone changed the table name but missed the one screen that was doing the query in the code using the old column name.
The other thing i did differntly was use the hibernate query as opposed to the sql query. Again unless there is a good reason to use sql queries, like adhoc join of different tables, it is better to use hibernate mappings and hibernate queries. [ July 03, 2006: Message edited by: Travis Hein ]
Error: Keyboard not attached. Press F1 to continue.
<!-- read only bean mapped for TableB Since we have the column id above as a column, we must specify the insert=false & update=false here. Alternatively, we could move them to the testId property, which makes the testId property read only and then the TableB is always saved when TableA is saved, but you didn't want that. -->