Thank you, Kevin.

Yes, I read those.

For SchemaTool:

Most users will only access the schema tool indirectly, through the
interfaces provided by other tools. You may find, however, that the
schema tool is a powerful utility in its own right. The schema tool has
two functions: 

     1. To reflect on the current database schema, optionally
        translating it to an XML representation for further
        manipulation. 
        
     2. To take in an XML schema definition, calculate the differences
        between the XML and the existing database schema, and apply the
        necessary changes to make the database match the XML. 
        
The keyword for me is:
 --> and apply the necessary changes to make the database 
     match the XML

So, it would seem that the SchemaTool is what I want.

I am trying to use the openjpa-maven-plugin. Seems like the best way to
integrate this into my build process. However, when I run mvn
openjpa:schema, it's not getting applied to my DB (though the schema.xml
file is correctly generated and placed in my target directory).

Here's the relevant part of my pom:

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>openjpa-maven-plugin</artifactId>
        <!-- use locally patched version for now -->
        <version>1.1-SNAPSHOT</version>
        <configuration>
          <includes>src/main/java/**/*.class</includes>
          <addDefaultConstructor>true</addDefaultConstructor>

<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
          <schemaAction>add</schemaAction>
          <toolProperties>
            <property>
              <name>addDefaultConstructor</name>
              <value>true</value>
            </property>
            <property>
              <name>enforcePropertyRestrictions</name>
              <value>true</value>
            </property>
            <property>
              <name>properties</name>
              <value>${basedir}/META-INF/persistence.xml</value>
            </property>
          </toolProperties>
        </configuration>
        <executions>
          <execution>
            <id>enhancer</id>
            <phase>process-classes</phase>
            <goals>
              <goal>enhance</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa</artifactId>
            <version>1.2.0</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>




On Thu, 2009-03-26 at 09:06 -0500, Kevin Sutter wrote:
> Hi David,
> OpenJPA has the same type of tooling that Kodo used to have.  OpenJPA
> provides the SchemaTool [1].  We also provide a MappingTool [2].  Would
> either of these help you out?
> 
> Kevin
> 
> [1]
> http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/manual.html#ref_guide_schema_schematool
> [2]
> http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/manual.html#ref_guide_mapping_mappingtool
> 
> On Thu, Mar 26, 2009 at 1:16 AM, David Leangen <k...@leangen.net> wrote:
> 
> >
> > Hello,
> >
> > After making a patch and applying a workaround to the
> > openjpa-maven-plugin, I am now able to create my schema file.
> >
> >   http://jira.codehaus.org/browse/MOJO-1324
> >   http://jira.codehaus.org/browse/MOJO-1325
> >
> >
> > Now, I may just be dense, but I can't seem to figure out from the
> > documentation how to commit the schema to my DB...
> >
> > I used to use Kodo JDO, and the schema tool would actually make the
> > changes to my DB.
> >
> > If somebody could explain what I'm doing wrong, I'd really appreciate
> > it!
> >
> >
> > Thank you!
> > =dml
> >
> >
> >
> >

Reply via email to