-->
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.  [ 3 posts ] 
Author Message
 Post subject: How to turn off schemaupdate
PostPosted: Mon May 11, 2009 4:43 am 
Beginner
Beginner

Joined: Sat Feb 07, 2009 4:08 pm
Posts: 22
Location: New York City
How do I turn off schemaupdate so that it does not run when I start up my tomcat server?

All the info I could find said to simply remove that property from persistence.xml. Which I have done. But schemaupdate still runs every time.

Is there another place I need to check?

I am using hibernate 3.3 and Spring 2.5 using JPA

Persistence.xml
Code:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
   version="1.0">

<persistence-unit name="myapp" >
   <properties>
      
   <!--<property name="hibernate.show_sql" value="true" />-->
        <property name="hibernate.format_sql" value="true" />
        <property name="hibernate.use_sql_comments" value="true" />   
   </properties>
   </persistence-unit>
</persistence>


Top
 Profile  
 
 Post subject: Re: How to turn off schemaupdate
PostPosted: Mon May 11, 2009 4:52 am 
Regular
Regular

Joined: Thu Apr 14, 2005 10:39 am
Posts: 115
Just use one of these:
Code:
HIBERNATE_PROPERTIES.setProperty(org.hibernate.cfg.Environment.HBM2DDL_AUTO, "none");

HIBERNATE_PROPERTIES.setProperty(org.hibernate.cfg.Environment.HBM2DDL_AUTO, "none");

<property name="org.hibernate.cfg.Environment.HBM2DDL_AUTO"> none</property>


Top
 Profile  
 
 Post subject: Re: How to turn off schemaupdate
PostPosted: Mon May 11, 2009 4:55 am 
Beginner
Beginner

Joined: Sat Feb 07, 2009 4:08 pm
Posts: 22
Location: New York City
OK. Apparently I didn't realize that Spring's HibernateJpaVendorAdapter has a generateDdl property that in effect turns on schemaupdate. Removing that line fixed my problem and turned off schemaupdate.

Code:
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
     <property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect" />
      <property name="showSql" value="true" />
      <!--<property name="generateDdl" value="true" /> -->      
</bean>


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

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.