Homework 8 (Spring 4 notes)

 

Expand SpringHWAfterPhase4. (look in the Notes section for this zip file - you might want to run it first before making changes).

 

There is a problem though.

 

In Student.hbm.xml, I have this:

 

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="bus.Student" table="STUDENTS">
    <id name="userid" type="string" column="USERID">
      <generator class="native"/>
    </id>
    <property name="firstName" column="FNAME"/>
    <property name="lastName" column="LNAME"/>
    <set name="enrolls">
        <key column="USERID" />
        <one-to-many class="bus.Enrollment" />
    </set>
  </class>
</hibernate-mapping>

 

Instead change it to this:

 

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="bus.Student" table="STUDENTS">
    <id name="userid" type="string" column="USERID">
      <generator class="assigned"/>
    </id>
    <property name="firstName" column="FNAME"/>
    <property name="lastName" column="LNAME"/>
    <set name="enrolls">
        <key column="USERID" />
        <one-to-many class="bus.Enrollment" />
    </set>
  </class>
</hibernate-mapping>

 

 

Have a jsp that allows the user to add a new Student. This will of course modify the database. Modify whatever files need to be modified.