All my primary keys are defined something like this:-
In my current application, user A inserts a new record and acquires the newly inserted record.
In the above scenario, the printout displays null ID value.
When I look at the log, it seems like Hibernate only writes to database right after I do the printout.
When I do a flush prior to printout, then it works as expected:-
In this example, is it the time I would need to flush the session? Or is there other way to obtain the ID value?
The one-to-many relation between these 2 tables are set up like this:-
Any suggestion is appreciated. Thanks.