[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2075) many-to-one in a properties element causes strange PropertyValueException on flush
Gail Badner (JIRA)
noreply at atlassian.com
Wed Nov 23 04:03:19 EST 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2075?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44385#comment-44385 ]
Gail Badner commented on HHH-2075:
----------------------------------
I've reproduced this in master. It seems that properties within a <properties> tag are not processed correctly.
This test case has:
<properties name="defaultPixelsTag">
<property name="defaultPixels" type="java.lang.Boolean"/>
<many-to-one
name="image"
class="Image"
column="image"
not-null="true"
unique="false"
cascade="lock,merge,persist,replicate,refresh,save-update"
insert="true"
update="true"
>
</many-to-one>
</properties>
<property name="sizeC" type="java.lang.Integer"
not-null="true" unique="false"
update="true"
/>
Merge is not being cascaded to the many-to-one, and sizeC is erroneously nullified.
> many-to-one in a properties element causes strange PropertyValueException on flush
> ----------------------------------------------------------------------------------
>
> Key: HHH-2075
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2075
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.2.0.cr4
> Environment: HSQLDB
> Hibernate r10478
> Reporter: Josh Moore
> Attachments: exception.txt, log.txt, properties.zip
>
>
> Full test directory zip (org/hibernate/test/properties) attached. But to summarize, the following test will fail on flush after a simple merge. The exception thrown says that Pixels.sizeC is null -- though it's clearly set in the test case.
> <code>
> Image i = new Image();
>
> Pixels p = new Pixels();
> p.setSizeC(new Integer(2));
> p.setImage(i); // This calls i.getPixels().add(p)
> // i.setPixels(null); // This makes it work.
>
> Session s = openSession();
> Transaction t = s.beginTransaction();
> // s.merge(i); // This makes it work.
> p = (Pixels) s.merge(p); // This fails with the exception below.
> t.commit();
> s.close();
> </code>
> The properties element in question is:
> <code>
> <properties name="defaultPixelsTag">
> <property name="defaultPixels" type="java.lang.Boolean"/>
> <many-to-one name="image" class="Image" column="image"
> not-null="true" unique="false" insert="true" update="true"
> cascade="lock,merge,persist,replicate,refresh,save-update"
> />
> </properties>
> </code>
> The reverse side is:
> <code>
> <set
> name="pixels"
> lazy="true"
> inverse="true"
> cascade="lock,merge,persist,replicate,refresh,save-update">
> <key column="image" not-null="false"/>
> <one-to-many class="Pixels"/>
> </set>
> </code>
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list