Issue Details (XML | Word | Printable)

Key: HHH-2075
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Josh Moore
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hibernate Core

many-to-one in a properties element causes strange PropertyValueException on flush

Created: 14/Sep/06 04:06 AM   Updated: 14/Sep/06 04:06 AM
Component/s: core
Affects Version/s: 3.2.0.cr4
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Text File exception.txt (4 kB)
2. Text File log.txt (32 kB)
3. Zip Archive properties.zip (9 kB)

Environment:
HSQLDB
Hibernate r10478


 Description  « Hide
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>

 All   Comments   Work Log   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.