-->
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: hbm2ddl, annotations, mysql
PostPosted: Wed Feb 15, 2006 11:03 am 
Newbie

Joined: Wed Feb 15, 2006 10:56 am
Posts: 1
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() {
}

....
--------------------------------------


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