Announcement Announcement Module
Collapse
No announcement yet.
Wierd Bug? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wierd Bug?

    Spring 1.1 rc 2
    Hibernate 2.1.6


    This code works in eclipse 3.0 (SDK 1.4.2_05) but causes the thread of execution to terminate with no exceptions in WSAD 5.1 (default SDK implementation that installs with WSAD).
    Code:
    Long l =  (Long) getHibernateTemplate().save(r);
    This code works in the above mentioned WSAD
    Code:
    Long l;
    try {
       l =
       (Long) getHibernateTemplate()
    	.getSessionFactory()
    	.openSession()
    	.save(r);
    } catch (HibernateException e) {
       throw getHibernateTemplate().convertHibernateAccessException(e);
    }		
    return l;
    Calling code:

    Code:
    PSF2734RootRecord pr = new PSF2734RootRecord();
    PSF2734DetailRecord pd = new PSF2734DetailRecord();
    pd.setSequenceNumber(123);
    pd.setRoot(pr);
    Set s = new HashSet();
    s.add(pd);
    pr.setDetails(s);
    pr.setSerialNumber("AZ " + RandomStringUtils.randomAlphanumeric(6));
    dao.savePSF2734(pr);
    Mapping files
    Code:
    <?xml version="1.0"?>
    
    <!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 2.0//EN" 
        "http&#58;//hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
    
    <hibernate-mapping>
        <class
            name="gov.usps.sakcarrier.db.vo.PSF2734DetailRecord"
            table="PSF2734_DETAILS"
            dynamic-update="false"
            dynamic-insert="false"
        >
    
            <id
                name="id"
                column="DETAIL_ID"
                type="int"
                unsaved-value="-1"
            >
                <generator class="sequence">
                    <param name="sequence">PSF2734DETAIL_ID_SEQ</param>
                </generator>
            </id>
    
            <many-to-one
                name="root"
                class="gov.usps.sakcarrier.db.vo.PSF2734RootRecord"
                cascade="none"
                outer-join="auto"
                update="true"
                insert="true"
                access="property"
                column="PSF2734ROOT_ID"
            />
    
            <property
                name="sequenceNumber"
                type="int"
                update="true"
                insert="true"
                access="property"
                column="SEQUENCE_NUM"
                not-null="true"
                unique="false"
            />
    
            <!--
                To add non XDoclet property mappings, create a file named
                    hibernate-properties-PSF2734DetailRecord.xml
                containing the additional properties and place it in your merge dir.
            -->
    
        </class>
    
    </hibernate-mapping>
    Code:
    <?xml version="1.0"?>
    
    <!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 2.0//EN" 
        "http&#58;//hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
    
    <hibernate-mapping>
        <class
            name="gov.usps.sakcarrier.db.vo.PSF2734RootRecord"
            table="PSF2734_ROOT"
            dynamic-update="false"
            dynamic-insert="false"
        >
    
            <id
                name="id"
                column="ROOT_ID"
                type="int"
                unsaved-value="-1"
            >
                <generator class="sequence">
                    <param name="sequence">PSF2734ROOT_ID_SEQ</param>
                </generator>
            </id>
    
            <property
                name="serialNumber"
                type="string"
                update="true"
                insert="true"
                access="property"
                column="SERIAL_NUMBER"
                length="9"
                not-null="true"
                unique="true"
            />
    
            <set
                name="details"
                lazy="true"
                inverse="true"
                cascade="all-delete-orphan"
                sort="unsorted"
            >
    
                  <key
                      column="PSF2734ROOT_ID"
                  >
                  </key>
    
                  <one-to-many
                      class="gov.usps.sakcarrier.db.vo.PSF2734DetailRecord"
                  />
            </set>
    
            <!--
                To add non XDoclet property mappings, create a file named
                    hibernate-properties-PSF2734RootRecord.xml
                containing the additional properties and place it in your merge dir.
            -->
    
        </class>
    
    </hibernate-mapping>
    Let me know if there is anything else I can provide to help track this bug(?) down. As I said, the stack trace shows no exceptions, just the tread terminating (abnormally, I might add, as there are further operations).

  • #2
    After further research, I think that this is caused by the call to session.flush() so it's probably not spring related.

    Comment

    Working...
    X