i have a userbean that has a 1-to-1 mapping with an addressbean and a profilebean. here is the hbm.xml
Code:
<hibernate-mapping>
<class name="omni.user.UserBean" table="users"
dynamic-update="false" dynamic-insert="false">
<id name="id" column="id" type="long" unsaved-value="-1" >
<generator class="native">
</generator>
</id>
<property name="email" type="java.lang.String" update="true"
insert="true" column="email" not-null="true" unique="true" />
<property name="password" type="java.lang.String" update="true"
insert="true" column="password" not-null="true" unique="false"
/>
<one-to-one name="address" class="omni.user.AddressBean"
cascade="all" outer-join="auto" constrained="true" />
<one-to-one name="profile" class="omni.user.ProfileBean"
cascade="all" outer-join="auto" constrained="true" />
</class>
</hibernate-mapping>
what i am trying to understand is if i make a call like
Code:
UserBean user = new UserBean();
user.setEmail(testEmail1);
user.setPassword("hello");
user.getProfile().setRole("user");
user.getAddress().setCity("detroit");
...
Session s = openSession();
s.save(user);
...
shouldn't hibernate cascade the saves/updates to the addressbean and profilebean table?
thanks,
jason