Ok, I switched to a saveOrUpdate() call, and it appears to have gotten a little further. However, this time, neither the album or the image got saved. Here is the code for the save:
Code:
logger.debug( obj.toString() );
Transaction trans = hibernateSession.beginTransaction();
hibernateSession.saveOrUpdate(obj);
logger.debug( "obj has been saved" );
trans.commit();
and the log:
Code:
####<begin>
####<unsaved-value strategy NULL>
####<saveOrUpdate() previously saved instance with id: 0>
####<updating [com.sullins.data.Album#0]>
####<collection dereferenced while transient [com.sullins.data.Album.images#0]>
####<processing cascades for: com.sullins.data.Album>
####<cascading to collection: com.sullins.data.Album.images>
####<cascading to saveOrUpdate()>
####<unsaved-value strategy NULL>
####<saveOrUpdate() previously saved instance with id: 0>
####<updating [com.sullins.data.Image#0]>
####<done processing cascades for: com.sullins.data.Album>
####<obj has been saved>
####<commit>
####<flushing session>
####<processing cascades for: com.sullins.data.Album>
####<cascading to collection: com.sullins.data.Album.images>
####<cascading to saveOrUpdate()>
####<saveOrUpdate() persistent instance>
####<done processing cascades for: com.sullins.data.Album>
####<Flushing entities and processing referenced collections>
####<Wrapped collection in role: com.sullins.data.Album.images>
####<Updating entity: [com.sullins.data.Album#0]>
####<Collection found: [com.sullins.data.Album.images#0], was: [<unreferenced>]>
####<Updating entity: [com.sullins.data.Image#0]>
####<Processing unreferenced collections>
####<Scheduling collection removes/(re)creates/updates>
####<Flushed: 0 insertions, 2 updates, 0 deletions to 3 objects>
####<Flushed: 1 (re)creations, 0 updates, 1 removals to 1 collections>
####<executing flush>
####<Updating entity: com.sullins.data.Album#0>
####<about to open: 0 open PreparedStatements, 0 open ResultSets>
####<prepared statement get: update album set date=?, description=?, owner=?, title=? where id=?>
Hibernate: update album set date=?, description=?, owner=?, title=? where id=?
####<preparing statement: update album set date=?, description=?, owner=?, title=? where id=?>
####<Dehydrating entity: com.sullins.data.Album#0>
####<binding '22-0-2004' to parameter: 1>
####<binding 'I wonder how I should make paragraphs?' to parameter: 2>
####<binding 'bsullins' to parameter: 3>
####<binding 'The new title for it' to parameter: 4>
####<binding '0' to parameter: 5>
####<Adding to batch>
####<Updating entity: com.sullins.data.Image#0>
####<Executing batch size: 1>
####<done closing: 0 open PreparedStatements, 0 open ResultSets>
####<recaching>
####<total checked-out statements: 0>
####<checked out: []>
####<about to open: 0 open PreparedStatements, 0 open ResultSets>
####<prepared statement get: update image set album_id=?, description=?, filename=?, owner=?, thumbn
ailFilename=?, title=? where id=?>
Hibernate: update image set album_id=?, description=?, filename=?, owner=?, thumbnailFilename=?, tit
le=? where id=?
####<preparing statement: update image set album_id=?, description=?, filename=?, owner=?, thumbnail
Filename=?, title=? where id=?>
####<Dehydrating entity: com.sullins.data.Image#0>
####<binding '0' to parameter: 1>
####<binding 'This is the first image of the test' to parameter: 2>
####<binding 'testimage.gif' to parameter: 3>
####<binding 'bsullins' to parameter: 4>
####<binding null to parameter: 5>
####<binding 'the first image' to parameter: 6>
####<binding '0' to parameter: 7>
####<Adding to batch>
####<Executing batch size: 1>
####<done closing: 0 open PreparedStatements, 0 open ResultSets>
####<recaching>
####<total checked-out statements: 0>
####<checked out: []>
####<post flush>
####<transaction completion>
should I be doing a flush() before the commit?