You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by David Leangen <ko...@leangen.net> on 2009/03/26 07:16:23 UTC

Schema changes not getting committed to the DB

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




Re: Schema changes not getting committed to the DB

Posted by David Leangen <ko...@leangen.net>.
Thank you again very much, Kevin,

I plan to get back to this latter, along with some other "issues" I'm
having. My priority right now is just to get this working before getting
it "right".


Thanks!
=David


On Fri, 2009-03-27 at 09:06 -0500, Kevin Sutter wrote:
> David,
> Have you tried using the SchemaTool standalone from the command line?  Using
> the same options as you have specified in for the maven plugin?  This would
> help isolate the problem.  I'm not aware of any problems with the SchemaTool
> itself, but there have been a few discussions on various aspects of our
> tooling.  If you could try that out, it would help with the investigation.
> 
> Thanks,
> Kevin
> 
> On Thu, Mar 26, 2009 at 8:40 PM, David Leangen <ko...@leangen.net> wrote:
> 
> >
> > 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 <ko...@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
> > > >
> > > >
> > > >
> > > >
> >
> >


Re: Schema changes not getting committed to the DB

Posted by Kevin Sutter <kw...@gmail.com>.
David,
Have you tried using the SchemaTool standalone from the command line?  Using
the same options as you have specified in for the maven plugin?  This would
help isolate the problem.  I'm not aware of any problems with the SchemaTool
itself, but there have been a few discussions on various aspects of our
tooling.  If you could try that out, it would help with the investigation.

Thanks,
Kevin

On Thu, Mar 26, 2009 at 8:40 PM, David Leangen <ko...@leangen.net> wrote:

>
> 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 <ko...@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
> > >
> > >
> > >
> > >
>
>

Re: Schema changes not getting committed to the DB

Posted by David Leangen <ko...@leangen.net>.
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 <ko...@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
> >
> >
> >
> >


Re: Schema changes not getting committed to the DB

Posted by Kevin Sutter <kw...@gmail.com>.
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 <ko...@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
>
>
>
>