Hi,
I have a map there the values of type String can be null (as I remember Oracle also stores empty strings as null).
I can add elements and get the elements without a problem. If I want to remove the elements, the are successfully removed from the Java-Map, but they still exists in the database. So the following code would fail:
session.open()
...
session.beginTransaction()
productElements.put(element, null)
productElements.remove(element)
assert(!productElements.containsKey(element))
session.commitTransaction()
session.close()
...
session.open()
...
assert(!productElements.containsKey(element)) //failure
Hibernate version: 2.1.8
Mapping documents:
<map name="productElements" lazy="false" table="PRODUCTELEMENTCONFIGURATION" cascade="none">
<key column="id" />
<index-many-to-many column="productId"
class="de.mtu.eprotas.application.product.model.impl.ProductElementImpl" />
<element type="string" column="classification" not-null="false" />
</map>
Code between sessionFactory.openSession() and session.close():
localSession.beginTransaction();
productElements.remove(element);
localSession.commitTransaction();
Name and version of the database you are using: oracle9/10
The generated SQL (show_sql=true):
Hibernate: select userimpl0_.id as id0_, userimpl0_.name as name0_, userimpl0_.userKey as userKey0_, userimpl0_.email as email0_ from UserImpl userimpl0_ where userimpl0_.id=?
Hibernate: select roles0_.id as id__, roles0_.elt as elt__, roleimpl1_.id as id0_, roleimpl1_.name as name0_, roleimpl1_.label as label0_, roleimpl1_.email as email0_ from USER_ROLE roles0_ inner join RoleImpl roleimpl1_ on roles0_.elt=roleimpl1_.id where roles0_.id=?
Hibernate: select productcon0_.id as id2_, productcon0_.static as static2_, productcon0_.creationDate as creation4_2_, productcon0_.modifyDate as modifyDate2_, productcon0_.name as name2_, productcon0_.user_ref as user_ref2_, productcon0_.description as descript8_2_, userimpl1_.id as id0_, userimpl1_.name as name0_, userimpl1_.userKey as userKey0_, userimpl1_.email as email0_, descriptio2_.id as id1_, descriptio2_.helpUrl as helpUrl1_, descriptio2_.imageUrl as imageUrl1_, descriptio2_.language as language1_, descriptio2_.text as text1_ from ProductConfigurationImpl productcon0_ left outer join UserImpl userimpl1_ on productcon0_.user_ref=userimpl1_.id left outer join DescriptionImpl descriptio2_ on productcon0_.description=descriptio2_.id where productcon0_.id=?
Hibernate: select productele0_.id as id__, productele0_.classification as classifi2___, productele0_.productId as productId__ from PRODUCTELEMENTCONFIGURATION productele0_ where productele0_.id=?
Hibernate: select productele0_.id as id10_, productele0_.class as class10_, productele0_.parent as parent10_, productele0_.description as descript4_10_, productele0_.label as label10_, productele0_.name as name10_, productele0_.productelementtype as producte7_10_, productele0_.inherited as inherited10_, productele0_.owner as owner10_, productele0_.adminGroup as adminGroup10_, productele0_.version_date as version11_10_, productele0_.version_processid as version12_10_, productele0_.version_number as version13_10_, productele0_.datastructtype as datastr14_10_, productele0_.status as status10_, productele0_.value as value10_, productele0_.filesize as filesize10_, productele0_.dsdomain as dsdomain10_, productele0_.unit as unit10_, productele0_.abspath as abspath10_, productele0_.relpath as relpath10_, productele0_.variantname as variant22_10_, containeri1_.id as id0_, containeri1_.class as class0_, containeri1_.abspath as abspath0_, containeri1_.relpath as relpath0_, containeri1_.parent as parent0_, containeri1_.description as descript4_0_, containeri1_.label as label0_, containeri1_.name as name0_, containeri1_.productelementtype as producte7_0_, containeri1_.inherited as inherited0_, containeri1_.owner as owner0_, containeri1_.adminGroup as adminGroup0_, containeri1_.version_date as version11_0_, containeri1_.version_processid as version12_0_, containeri1_.version_number as version13_0_, containeri1_.variantname as variant22_0_, containeri2_.id as id1_, containeri2_.class as class1_, containeri2_.abspath as abspath1_, containeri2_.relpath as relpath1_, containeri2_.parent as parent1_, containeri2_.description as descript4_1_, containeri2_.label as label1_, containeri2_.name as name1_, containeri2_.productelementtype as producte7_1_, containeri2_.inherited as inherited1_, containeri2_.owner as owner1_, containeri2_.adminGroup as adminGroup1_, containeri2_.version_date as version11_1_, containeri2_.version_processid as version12_1_, containeri2_.version_number as version13_1_, containeri2_.variantname as variant22_1_, descriptio3_.id as id2_, descriptio3_.helpUrl as helpUrl2_, descriptio3_.imageUrl as imageUrl2_, descriptio3_.language as language2_, descriptio3_.text as text2_, userimpl4_.id as id3_, userimpl4_.name as name3_, userimpl4_.userKey as userKey3_, userimpl4_.email as email3_, groupimpl5_.id as id4_, groupimpl5_.name as name4_, groupimpl5_.email as email4_, groupimpl5_.label as label4_, groupimpl5_.managerGroup_id as managerG5_4_, groupimpl6_.id as id5_, groupimpl6_.name as name5_, groupimpl6_.email as email5_, groupimpl6_.label as label5_, groupimpl6_.managerGroup_id as managerG5_5_, descriptio7_.id as id6_, descriptio7_.helpUrl as helpUrl6_, descriptio7_.imageUrl as imageUrl6_, descriptio7_.language as language6_, descriptio7_.text as text6_, userimpl8_.id as id7_, userimpl8_.name as name7_, userimpl8_.userKey as userKey7_, userimpl8_.email as email7_, descriptio9_.id as id8_, descriptio9_.helpUrl as helpUrl8_, descriptio9_.imageUrl as imageUrl8_, descriptio9_.language as language8_, descriptio9_.text as text8_, userimpl10_.id as id9_, userimpl10_.name as name9_, userimpl10_.userKey as userKey9_, userimpl10_.email as email9_ from ProductElementImpl productele0_ left outer join ProductElementImpl containeri1_ on productele0_.parent=containeri1_.id left outer join ProductElementImpl containeri2_ on containeri1_.parent=containeri2_.id left outer join DescriptionImpl descriptio3_ on containeri2_.description=descriptio3_.id left outer join UserImpl userimpl4_ on containeri2_.owner=userimpl4_.id left outer join GroupImpl groupimpl5_ on containeri2_.adminGroup=groupimpl5_.id left outer join GroupImpl groupimpl6_ on groupimpl5_.managerGroup_id=groupimpl6_.id left outer join DescriptionImpl descriptio7_ on containeri1_.description=descriptio7_.id left outer join UserImpl userimpl8_ on containeri1_.owner=userimpl8_.id left outer join DescriptionImpl descriptio9_ on productele0_.description=descriptio9_.id left outer join UserImpl userimpl10_ on productele0_.owner=userimpl10_.id where productele0_.id=?
Hibernate: select roles0_.id as id__, roles0_.elt as elt__, roleimpl1_.id as id0_, roleimpl1_.name as name0_, roleimpl1_.label as label0_, roleimpl1_.email as email0_ from USER_ROLE roles0_ inner join RoleImpl roleimpl1_ on roles0_.elt=roleimpl1_.id where roles0_.id=?
13:51:49,756 [RequestProcessor-4] DEBUG Maptype:net.sf.hibernate.collection.Map -- at de.mtu.eprotas.application.product.configuration.impl.ProductConfigurationImpl.removeProductElement(ProductConfigurationImpl.java:214)
Hibernate: update ProductConfigurationImpl set static=?, creationDate=?, modifyDate=?, name=?, user_ref=?, description=? where id=?
|