-->
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.  [ 1 post ] 
Author Message
 Post subject: Could not synchronize database state with session
PostPosted: Wed Mar 02, 2005 3:17 pm 
Beginner
Beginner

Joined: Sun Jan 09, 2005 5:16 pm
Posts: 20
Hibernate version:
2.1.6

Mapping documents:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class name="com.nccc.model.Listing" table="LISTING">
       <cache usage="read-write" />
        <id name="id" type="long" column="LISTING_ID">
            <generator class="increment"/>
        </id>
      <property type="string" name="shortDesc" column="LISTING_SHORTDESC" not-null="true"/>
        <property type="string" name="longDesc" column="LISTING_LONGDESC" not-null="true"/>
        <property type="string" name="longDescFormatted" column="LISTING_LONGDESC_FORMATTED"
                                                       not-null="true"/>
        <many-to-one name="userId" column="LISTING_USERID" class="com.nccc.model.User"/>
        <many-to-one name="buyerId" column="LISTING_BUYERID" class="com.nccc.model.User"/>
      <property type="timestamp" name="startDate" column="LISTING_START_DATE" not-null="true"/>
      <property type="timestamp" name="endDate" column="LISTING_END_DATE" not-null="true"/>
      <property type="double" name="price" column="LISTING_PRICE" not-null="true"/>
      <!--
         0: no
         n: yes (listed n times)
       -->
      <property type="integer" name="isListed" column="LISTING_ISLISTED" not-null="true"/>
      <!--
         paypalAccepted
         0: no
         1: yes
         2: preferred
         3: required
      -->
      <property type="integer" name="paypalAccepted" column="LISTING_PAYPAL_ACCEPTED"
                                          not-null="true"/>
      <set name="pics">
           <key column="LISTING_ID"/>
           <one-to-many class="com.nccc.model.Picture"/>
       </set>
        <many-to-one name="catId" column="LISTING_CATID" class="com.nccc.model.Category"/>
   </class>
</hibernate-mapping>



Full stack trace of any exception that occurs:
Code:
SessionImpl.execute(2379) | Could not synchronize database state with session
net.sf.hibernate.HibernateException: Batch update row count wrong: 0
   at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:65)
   at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:126)
   at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2421)
   at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2375)
   at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2240)
   at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
   at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:472)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:377)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:243)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:66)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
   at $Proxy10.saveListing(Unknown Source)
   at com.nccc.web.ListingWizard.processFinish(ListingWizard.java:118)
   at org.springframework.web.servlet.mvc.AbstractWizardFormController.validatePagesAndFinish(AbstractWizardFormController.java:583)
   at org.springframework.web.servlet.mvc.AbstractWizardFormController.processFormSubmission(AbstractWizardFormController.java:443)


Name and version of the database you are using:
Postgres 8


I've run into this problem before when I was using an id that I specified, so I had to explicitly call save() instead of saveOrUpdate(), but that isn't the case with this object.

The exception occurs when I try to save the listing. This is my toString() of the listing object before and after the call has been made. I have looked at the FAQ concerning this error. All of the primitive types have values, so I'm not sure what's happening.

Code:
before:
ListingWizard.processFinish(117) | com.nccc.model.Listing@1db1fe0[pics=[null],longDesc=test,id=<null>,shortDesc=test,price=0.0,isListed=1,longDescFormatted=test,buyerId=<null>,endDate=Wed Mar 02 01:58:19 CST 2005,paypalAccepted=0,startDate=Wed Mar 02 01:58:19 CST 2005,userId=com.nccc.model.User@1a0abea[id=0264368],catId=com.nccc.model.Category@162c87a[id=12]]

after:
ListingManagerImpl.saveListing(52) | com.nccc.model.Listing@1db1fe0[pics=[null],longDesc=test,id=1,shortDesc=test,price=0.0,isListed=1,longDescFormatted=test,buyerId=<null>,endDate=Wed Mar 02 01:58:19 CST 2005,paypalAccepted=0,startDate=Wed Mar 02 01:58:19 CST 2005,userId=com.nccc.model.User@1a0abea[id=0264368],catId=com.nccc.model.Category@162c87a[id=12]]


Any help would be greatly appreciated. This code did work for a few weeks and I'm honestly not sure when it broke, otherwise I probably would have been able to track down the problem.


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.