当我试图在我下面的单位测试中 flu缩时,我会收到“不能使数据库状况与届会同步”。
谁能告诉问题是什么,因为我已经完全消失? 我只是试图在没有任何属性的情况下制定一条定义,而这种定义也不奏效。
成就
这是我的单位试验的幻灯。 摘要 翻译
@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();
}
DAO方法仅指一种储蓄业务。 这是我的绘图档案。
<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>
这是我春天组合档案的幻灯。
<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:abcdefhibernate-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>