[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4947) Silent exclusion of null-valued map entry

Tsering Shrestha (JIRA) noreply at atlassian.com
Tue Feb 23 15:52:51 EST 2010


Silent exclusion of null-valued map entry
-----------------------------------------

                 Key: HHH-4947
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4947
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.0-CR-1, 3.3.2
            Reporter: Tsering Shrestha


<class name="Product">
  <id name="id">
    <generator class="native"/>
  </id>
  <map name="sellingPrice">
  <key column="PRODUCT" not-null="true" foreign-key="FK_SP_PRODUCT"/>
  <map-key type="string" column="model" not-null="true"/>
  <element type="double" column="price" not-null="false"/>
  </map>
</class>

Product product = new Product();
Product.getSellingPrice().put("XL",null);
Product.getSellingPrice().put("L", 34.90);
session.save(product)

Gives the following SQL:

insert into PRODUCT (id) values (null)
call identity()
insert into SELLINGPRICE (PRODUCT, MODEL, PRICE) values (?, ?, ?)

And the SELLINGPRICE table indeed only has one row. Why does Hibernately *silently* remove my null-valued entry? I would either want it to be able to save the entry or raise an exception that it cannot.


Report this post

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list