Sorry - got a bit carried away there and pressed send by mistake:

The answer to both is yes. Look for the configuration of the
hibernate3-maven-plugin and change as follows:

         <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>hibernate3-maven-plugin</artifactId>
               <version>2.0-alpha-1</version>
               <configuration>
                   <components>
                       <component>
                           <name>hbm2ddl</name>

<implementation>annotationconfiguration</implementation>
                       </component>
                   </components>
                   <componentProperties>

<outputfilename>your_schema_filename.sql</outputfilename>
                       <drop>false</drop>
                       <create>false</create>
                       <update>true</update>
                       <jdk5>true</jdk5>

<propertyfile>target/test-classes/jdbc.properties</propertyfile>

<configurationfile>src/test/resources/hibernate.cfg.xml</configurationfile>
                       <skip>${maven.test.skip}</skip>
                   </componentProperties>
               </configuration>
               <executions>
                   <execution>
                       <phase>process-test-resources</phase>
                       <goals>
                           <goal>hbm2ddl</goal>
                       </goals>
                   </execution>
               </executions>
               <dependencies>
                   <dependency>
                       <groupId>${jdbc.groupId}</groupId>
                       <artifactId>${jdbc.artifactId}</artifactId>
                       <version>${jdbc.version}</version>
                   </dependency>
               </dependencies>
           </plugin>

The important bits are drop, create, update in the componentProperties
section. I would be very careful about doing an update on a production
database - I have had Hibernate completely mess up foreign key relationships
etc.

To run just enter: mvn hibernate3:hbm2ddl

More doco etc on the Hibernate 3 plugin here:
http://mojo.codehaus.org/maven-hibernate3/hibernate3-maven-plugin/

Mike

On 7/4/07, Michael Horwitz <[EMAIL PROTECTED]> wrote:

The answer to both is yes. Look for the configuration of the
hibernate3-maven-plugin



On 7/4/07, Martin Ravell < [EMAIL PROTECTED]> wrote:
>
> I have an app which is in (limited) production. (Appfuse 2M5 Struts2
> basic) In development I've added a few new tables.
>
> Is there a way with maven that I can have these changes applied to the
> production database without wiping (deleting and rebuilding) the wholoe
> database? I want to keep the data in the existing tables.
>
> Failing this I imagine that I need to apply some table build scripts
> manually. Is there a way of dumping this ddl to a file so I can edit it
> to
> leave the existing tables?
>
>
> Regards
> Marty
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to