-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: JVM Crashes on flush() call
PostPosted: Thu Sep 02, 2004 1:07 pm 
Newbie

Joined: Fri Aug 13, 2004 12:17 pm
Posts: 12
Location: St. Louis, MO
Hibernate version: 2.1.6

Mapping documents:<?xml version="1.0"?>

Code:
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://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://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>


Code between sessionFactory.openSession() and session.close():
Code:
l = (Long) s.save(r);
s.flush();

Full stack trace of any exception that occurs:

Name and version of the database you are using:
Oracle 9i 9.0.2.4
Debug level Hibernate log excerpt:
Code:
[2004-09-02 11:51:50,248] DEBUG (net.sf.hibernate.type.LongType nullSafeSet.46)  - binding '336' to parameter: 8
[2004-09-02 11:51:50,248] DEBUG (net.sf.hibernate.impl.BatcherImpl addToBatch.28)  - Adding to batch
[2004-09-02 11:51:50,248] DEBUG (net.sf.hibernate.impl.BatcherImpl doExecuteBatch.50)  - Executing batch size: 1
[2004-09-02 11:51:50,388] DEBUG (net.sf.hibernate.impl.BatcherImpl doExecuteBatch.58)  - success of batch update unknown: 0
[2004-09-02 11:51:50,388] DEBUG (net.sf.hibernate.impl.BatcherImpl logClosePreparedStatement.207)  - done closing: 0 open PreparedStatements, 0 open ResultSets
[2004-09-02 11:51:50,388] DEBUG (net.sf.hibernate.impl.BatcherImpl closePreparedStatement.269)  - closing statement
[2004-09-02 11:51:50,451] DEBUG (net.sf.hibernate.impl.SessionImpl postFlush.2824)  - post flush


The problem in short is, when I flush the session, my thread of execution terminates without any exceptions. If I don't flush the session, the execution proceeds as normal.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 02, 2004 3:37 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
turn on sql log, is the sequence hit when calling session.save()?

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject: More info
PostPosted: Thu Sep 02, 2004 3:39 pm 
Newbie

Joined: Fri Aug 13, 2004 12:17 pm
Posts: 12
Location: St. Louis, MO
The code was failing inside hibernate's source on the line clonedSet.put(copied, copied) but I think it was failing on the deep copy from the previous line. I was finally able to track down the difference to the fact that in the version I had on eclipse, I had not extended my base object (code below)....this ended up solving the problem. Is there a problem with using reflection to generate the equals method when doing a deep copy by any chance? Anyways, the problem was related to my 2 persistant objects extending the base class listed below. Any advise on why that was occuring would be greatly appreciated.

excerpt from net.sf.hibernate.collection.Set
Code:
protected Serializable snapshot(CollectionPersister persister) throws HibernateException {
      //if (set==null) return new Set(session);
      HashMap clonedSet = new HashMap( set.size() );
      Iterator iter = set.iterator();
      while ( iter.hasNext() ) {
         Object copied = persister.getElementType().deepCopy( iter.next() );
         clonedSet.put(copied, copied);
      }
      return clonedSet;
   }


Code:
public class BaseObject implements Serializable {

   public String toString() {
      return ToStringBuilder.reflectionToString(
         this,
         ToStringStyle.MULTI_LINE_STYLE);
   }

   public boolean equals(Object o) {
      return EqualsBuilder.reflectionEquals(this, o);
   }

   public int hashCode() {
      return HashCodeBuilder.reflectionHashCode(this);
   }
}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 02, 2004 3:41 pm 
Newbie

Joined: Fri Aug 13, 2004 12:17 pm
Posts: 12
Location: St. Louis, MO
To answer your question Anthony, the insertions were occuring correctly and getting flushed...the error was occuring during the postflush operations.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.