Hello,
Hibernate version: 3.0.1
Mapping documents: Register.hbm.xml
Name and version of the database you are using: My SQL 4.1
Register.hbm.xml
[code]
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.evite.beans">
<class name="com.evite.beans.Register" lazy = "false" table="REGISTER" dynamic-update="false" dynamic-insert="false" select-before-update="false">
<id name="userid" column="USER_ID" type="string" >
<generator class="assigned"/>
</id>
<many-to-one name="address" class="com.evite.beans.Address" column = "ADDRESS_ID" cascade="delete" unique="true"/>
<property name="firstname" type="string" update="true" insert="true" column="FIRSTNAME" not-null="true" unique="false" optimistic-lock="true" lazy="false"/>
<property name="lastname" type="string" update="true" insert="true" column="LASTNAME" not-null="true" unique="false" optimistic-lock="true" lazy="false"/>
<property name="password" type="string" update="true" insert="true" column="PASSWORD" not-null="true" unique="false" optimistic-lock="true" lazy="false"/>
<property name="email" type="string" update="true" insert="true" column="EMAIL" not-null="true" unique="true" optimistic-lock="true" lazy="false"/>
<property name="language" type="string" update="true" insert="true" column="LANGUAGE" not-null="false" unique="false" optimistic-lock="true" lazy="false"/>
<set name="contacts" table="CONTACTS" lazy="true" inverse="false" cascade="all" sort="unsorted" optimistic-lock="true" embed-xml="true">
<key column="USER_ID" on-delete="noaction"/>
<one-to-many class="com.evite.beans.Contacts" not-found="exception" embed-xml="true"/>
</set>
<set name="events" table="EVENT" lazy="true" inverse="false" cascade="all" sort="unsorted" optimistic-lock="true" embed-xml="true">
<key column="USER_ID" on-delete="noaction"/>
<one-to-many class="com.evite.beans.Event" not-found="exception" embed-xml="true"/>
</set>
</class>
</hibernate-mapping>
[code]
I am creating a struts application wherein a person logs in and stores his list of events in the Event table. His personal information is stored in the Register table. First time user goes in and registers - his userid is the primary key for the register table. Now he comes back and logs in again and adds events to his list. At the time of saving the event, userid is not being added to the table.
How do I do that? why is the mapping not causing the value to be picked up from the register table as per his login? hw do i acheive this?
Help me someone,
Thanks,
Manju[/code]
|