Hello All,
I am using spring to manage hibernate sessions.
Everything works, except that my tables are dropped at startup.
Suggestions??
I am using java 1.5 annotations to define schema
Thanks,
Mike
-------------- spring config ------------
<beans>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref bean="dataSource"/></property>
<property name="configLocation"><value>/WEB-INF/classes/hibernate.cfg.xml</value></property>
<property name="configurationClass"><value>org.hibernate.cfg.AnnotationConfiguration</value></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialectc</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"><ref bean="sessionFactory"/></property>
</bean>
<bean id="txAttributeSource"
class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource">
<property name="properties">
<props>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="send*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"><ref local="transactionManager"/></property>
<property name="transactionAttributeSource"><ref local="txAttributeSource"/></property>
</bean>
<bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="interceptorNames">
<list> <idref local="txInterceptor"/></list>
</property>
<property name="beanNames">
<list>
<value>*Dao</value>
<value>*DAO</value>
</list>
</property>
</bean>
<bean id="testCaseDao" class="com.ugs.devops.devtesting.dao.TestCaseSpringDao">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
..
------------------------------
Annotated Class
@Entity
@Table(name = "test_case")
public class TestCase implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id= null;
@Column(unique=true, nullable = false, length = 255)
private String name;
@Column(length = 255)
private String description;
public TestCase() {
}
....
--------------------------------------
|