Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7774231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:19:32+00:00 2026-06-01T17:19:32+00:00

I am receiving the Could not synchronize database state with session when I attempt

  • 0

I am receiving the “Could not synchronize database state with session” when I attempt a flush in my unit test below.

Can anyone advise what the problem is as I am completely lost? I have tried just creating a RuleDefinition without any of its attributes set and that doesn’t work either.

Thanks

This is a snippet of my unit test which extends AbstractTransactionalDataSourceSpringContextTests

@Test
public void testCreateRule() {
    RuleDefinition ruleReturned = (RuleDefinition) hibernateRuleDefinitionDao.findRule(1);
    RuleDefinition newRule = new RuleDefinition();
    newRule.setCurrentState("ACTIVE");
    newRule.setAttribute(ruleReturned.getSecondaryAttribute());
    newRule.setSecondaryAttribute(ruleReturned.getAttribute());
    newRule.setOperator(ruleReturned.getOperator());
    newRule.setPrecedence(4);
    hibernateRuleDefinitionDao.createRule(newRule);
    // Exception is thrown after the flush
    hibernateTemplate.flush();   
}

The DAO method simply calls a save operation. This is my mapping file

<class name="abc.def.rules.RuleDefinition" table="REFDATA.CONFIG_RULE_DEFINITION">
    <id name="ruleId" column="RULE_ID">
        <generator class="increment"/>
    </id>
    <many-to-one name="attribute" cascade="none" class="abc.def.rules.ConfigAttribute" lazy="false" column="CONFIG_ATTR_ID"/>
    <many-to-one name="operator" cascade="none" class="abc.def.rules.Operator" lazy="false">
        <column name="OPRTR_VAL"/>
        <column name="OPRTR_VAL_DATA_TYP"/>
    </many-to-one>
    <many-to-one name="secondaryAttribute" cascade="none" class="abc.def.rules.ConfigAttribute" lazy="false" column="CONFIG_ATTR_ID_2" not-null="false"/>
    <property name="operand" column="OPRND_VAL" type="string"/>
    <property name="trueAction" column="TRUE_ACTN" type="string"/>
    <property name="falseAction" column="FALSE_ACTN" type="string"/>
    <property name="precedence" column="RULE_ORD_SEQ" type="int" not-null="true"/>
    <property name="currentState" column="RULE_STAT" type="string"/>
</class>

This is a snippet of my Spring configuration file

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
    <property name="url" value="jdbc:hsqldb:mem:testdb" />
    <property name="username" value="sa" />
    <property name="password" value="" />
</bean>

<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="configLocations">
        <list>
            <value>classpath:abc\def\hibernate-reference.cfg.xml</value>
        </list>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">
                org.hibernate.dialect.HSQLDialect
            </prop>
            <prop key="hibernate.cache.provider_class">
                org.hibernate.cache.NoCacheProvider
            </prop>
            <prop key="hibernate.cache.use_second_level_cache">
                false
            </prop>
            <prop key="hibernate.cache.use_query_cache">false</prop>
        </props>
    </property>
</bean>

<tx:annotation-driven transaction-manager="transactionManager" />

<bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:19:34+00:00Added an answer on June 1, 2026 at 5:19 pm

    I’ve managed to resolved this myself. My CONFIG_RULE_DEFINITION had a constraint specifying that a Timestamp column should be not null and should default to SYSDATE. However, SYSDATE does not work in HSQLDB I presume. For some reason, no such error was propogating up to notify me of this. Once I removed this constraint all worked fine!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am receiving a CoreData could not fulfill a fault for ... error message
I am receiving the following error message: 2011-02-11 14:47:13.815 myProject[13177:207] Could not load the
I'm receiving a System.Configuration.ConfigurationErrorsException with the message Could not load type 'XxxSiteMapProvider' from assembly
I am receiving the following warnings: Warning 1 Could not resolve assembly System.Xml.Linq. The
I'm receiving the error Could not initialize NSS in my java application when sending
I'm receiving feedback from a developer that The only way visual basic (6) can
I'm receiving this error String was not recognized as a valid DateTime with the
Im receiving this error The name 'Textbox1' does not exist in the current context
I need know how can I distribute the project. I am receiving the following
so i decided against using uploadify as i could not get any help on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.