openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andyatmiami <stone...@gmail.com>
Subject dropDB SQL generation doesn't seem to account for foreign keys
Date Fri, 13 Jul 2012 13:49:49 GMT
I want to issue a dropDB to clear out my existing database objects - but it
does not seem to account for Foreign Key constraints.  The drop statements
(which I am outputting to a sql file) seem to simply appear in alphabetical
order and once I try to execute the sql file, I get the following error: 

Cannot delete or update a parent row: a foreign key constraint fails 

Is there a way to drop all my tables if I am using foreign keys? I specify
these foreign keys through JPA Annotations - I am working on a "net new" DB
so there is no concern over existing Foreign Keys managed outside of my
code.  Thanks in advance. 

Andy 

Relevant pom config: 


      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>openjpa-maven-plugin</artifactId>
        <version>1.2</version>
        <configuration>
          <includes>com/seersoft/model/**/*.class</includes>
          <excludes>com/seersoft/model/**/Abstract*.class</excludes>
          <addDefaultConstructor>true</addDefaultConstructor>
          <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
         
<persistenceXmlFile>${project.build.outputDirectory}/META-INF/persistence.xml</persistenceXmlFile>
        </configuration>
        <executions>
          <execution>
            <id></id>
            <phase>process-classes</phase>
            <goals>
              <goal>enhance</goal>
            </goals>
          </execution>
          <execution>
            <id>generate</id>
            <phase>process-classes</phase>
            <configuration>
              <action>buildSchema</action>
              <sqlAction>dropDB</sqlAction>
            </configuration>
            <goals>
              <goal>sql</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa</artifactId>
            <version>${version.openjpa}</version>
          </dependency>
        </dependencies>
      </plugin>

--
View this message in context: http://openjpa.208410.n2.nabble.com/dropDB-SQL-generation-doesn-t-seem-to-account-for-foreign-keys-tp7580582.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message