I've written code that looks like listing 16.1 on page 699 (2nd edition). The code loads an Item (my code GETs a Product), instantiates a Bid and adds it to the Item (my code instantiates a Version and adds it to the product). It does this all within a transaction context, and on page 701 the notes for step 5 say that you don't have to save it manually, it's saved using transitive persistence (cascading from Item to Bid).

As near as I can tell, my Product and Version classes are structured in exactly the same way, using the same annotations, as the CaveatEmptor JPA example code. When it executes, I see that the new Version object is added to the in-memory list of Versions on the Product. But it never gets persisted. If I call session.save(ver) (on the new Version object), it properly saves. However, I shouldn't have to call that.

I get no exceptions, nor warnings in the log. I've included the last part of the log. I'm using Spring to manage some of this, otherwise it's happening in a struts action.

One thing that stands out: the logs say flush mode is NEVER. However, I never set the flush mode in my code, and the book says the default flush mode is AUTO. Perhaps Spring's AnnotationSessionFactoryBean is setting the flush mode? I've included the Spring config below, too.

Version ver = new Version(); ver.setUpdateVersion(uv); ver.setPubDate(Calendar.getInstance()); ver.setTitle(prod.getName() + " v" + uv); // Create a title from the product name and version prod.add(ver);