[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3836) composite-element with null columns in map is ignored

Benoit Goudreault-Emond (JIRA) noreply at atlassian.com
Fri Mar 27 08:54:38 EDT 2009


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benoit Goudreault-Emond updated HHH-3836:
-----------------------------------------

    Attachment: HHH-3836.zip

Oops, ignore the other file--it was using some weird backport for Collections.  This version is correct (and the zip file has a better name)

> composite-element with null columns in map is ignored
> -----------------------------------------------------
>
>                 Key: HHH-3836
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3836
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.0.SP1
>         Environment: 3.3.0 SP1, noticed with Oracle and H2 but probably happens with all databases
>            Reporter: Benoit Goudreault-Emond
>         Attachments: HHH-3836.zip, patate.zip
>
>
> When a composite element with all properties set to NULL is inserted in a map of the said composite element, the data gets inserted to the database but is never retreived when reloading the entity.
> For instance, with an entity
> @Entity
> public class TestEntity {
> 	@Id
> 	private int id;
> 	@CollectionOfElements
> 	private Map<String, AccessPeriod> roleAccesses = new HashMap<String, AccessPeriod>();
>         // boilerplate getters/setters/etc omitted
> }
> And AccessPeriod being
> @Embeddable
> public class AccessPeriod {
>         public Date startDate;
>         public Date endDate;
> }
> If you insert in the map an AccessPeriod with both startDate and endDate set to null and persist the TestEntity, 
> an entry is inserted in the auxiliary table, but when getting the TestEntity back, the map is empty.
> You get the same problem with a mapping file.
> This used to work in Hibernate 2.1--I found this out while porting some code to 3.3.
> See the attached example.  You'll need to include Hibernate and h2 (com.h2database:h2 1.0.20061217) on your classpath to run it with the given jdbc.properties, but feel free to change it.

-- 
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