My first message here. Congratulations for this great project! :D
But also, I have a problem with it :p. I can't remove a kind of objects from the database.
I have the folowing mapping for a class (with its subclasses)
Code:
<class name="GarmentContainer" table="containers">
<id name="container_ID" column="container_ID" type="long">
<generator class="identity"/>
</id>
<set name="contents">
<key column="container"/>
<one-to-many class="GarmentQuantity"/>
</set>
<joined-subclass name="Store" table="store">
<key column="container_ID"/>
<property name="code" type="string"/>
</joined-subclass>
<joined-subclass name="Box" table="boxes">
<key column="container_ID"/>
<property name="code" type="string"/>
<property name="location" type="string"/>
</joined-subclass>
<joined-subclass name="Sale" table="sales">
<key column="container_ID"/>
<many-to-one name="customer" class="Customer" not-null="true"/>
</joined-subclass>
</class>
Everything works great, except that i can't delete any Box from the database.
The code that i use, to delete the object is the following:
Code:
Session session = sf.openSession();
Box box = this.getBox(request.getParameter("code"), session);
...
do some things (remove all objects from the contents(SET) of the box)
...
and finaly try to remove the box
...
session.delete(box);
session.connection().commit();
session.flush();
session.close();
(I have also tried to set box.setContents(null) before deleting the box)
But nothing hapends. I don't know what is wrong. From the log files I see the SQL statements that say "delete from containers where container_ID=?" and "delete from boxes where container_ID=?".
Please tell me if I can provide any other details.
Thanks