Hello,
I am reading the AdminApp sources (0.9.1). First of all - a brilliant piece of work - very easy to follow. Thanks Gavin for this excellent sample of Hibernate+WebWork2.
A few questions that remained a bit unclear for me:
User and Role have their IDs defined as java.lang.Long. However in the HBM there is this:
Code:
<id name="id" column="USER_ID"
unsaved-value="0">
<!-- primitive int, so use
unsaved-value="0". -->
<generator class="increment"/>
</id>
Shouldn't the 'unsaved-value' be 'null' in this case?
What is actually the recommended way: have IDs as primitives or objects? What are the implications of either approach?
Also regarding caching:
In Role.hbm.xml therw is:
Code:
<!-- there are few roles, and they are
not updated so cache them -->
<cache usage="read-only"/>
If you define this 'read-only' but nevertheless write some objects (as is the case with roles) what happens? No problems if it is not a cluster?
Also in hibernate.cfg.xml there is:
Code:
<class-cache
class="org.hibernate.admin.model.Role"
region="Role"
usage="read-write"/>
I couldn't find anything in the docs about this. Isn't the 'read-write' conflicting with the Role.hbm.xml?
best regards,
erik