We have a class named Consumer:
Code:
<class name="Consumer" table="tbl_consumer">
<id name="id" column="id" type="integer">
<generator class="native"/>
</id>
....
....
<set name="consumerEpisodes"
inverse="true"
lazy="true"
cascade="all-delete-orphan" >
<key column="consumer_id" />
<one-to-many class="domain.ConsumerEpisode"/>
</set>
....
....
The Consumer class contains
a number of <set mappings, just like the one shown above. We use a web architecture where the Consumer is often detached (while in the view layer)and we add instances to the contained Sets (e.g adding a new consumerEpisode).
The question is as follows. In our arhitecture (uses transactional Service objects that calls DAOs) I can 1) call saveorupdate on the Consumer and relie on Hibernate finding the transient instances in the Set or 2) create methods to save the transient instances ( eg consumerEpisode) by itself. Is there a perfomance penalty to having Hibernate do this work(figuring out which instances in the set are transient and saving them) and if so how much of a penalty.
I have combed through the docs, but I'm still uncertain. Any insight will be much appreciated.
Code: