You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Tedman Leung <te...@sfu.ca> on 2009/03/10 16:21:49 UTC

Re: OpenJPA-1.2.0: SchemaToolTask does not have "dropTables" argument

Incidentally, with the MappingToolTask, if you use schemaAction="dropDB", 
at least in MySql, you don't get a drop DB command, you get drop table 
commands, which sounds like what you're trying to do. I don't know if this 
applies to the schemaTool or what the difference between the MappingTool 
and SchemaTool is though.

On Tue, Mar 10, 2009 at 10:12:04AM -0500, Kevin Sutter wrote:
> Hi,
> From what I can tell, this looks to be a blatant bug.  I can't find this
> argument ever being implemented in past releases, but I only went back as
> far as 1.0.x.  Please open a JIRA for this problem.
> 
> As far as workarounds...  It depends on what your need is.  If you really
> need to drop the tables, then you could either do it manually or use another
> tool, such as the MappingTool.  Or, maybe one of the other options on
> SchemaTool is sufficient like the actions of "deleteTableContents", or
> "dropDB".
> 
> Sorry for the inconvenience.
> Kevin
> 
> On Tue, Mar 10, 2009 at 5:37 AM, lfnoleto <lf...@genigraph.fr> wrote:
> 
> >
> > Hi,
> >
> > I think this is a bug. The task SchemaToolTask does not implements
> > "dropTables" argument. According to the documentation [1] this task can
> > take "dropTables" arguments
> > but when I run as shown below I get this error: The <schematool> type
> > doesn't support the "droptables" attribute.
> >
> >    <schematool dropTables="true" action="retain">
> >            <fileset dir="${build.sql.dir}">
> >                <include name="schema.xml" />
> >            </fileset>
> >            <config
> > propertiesFile="${prototype.src.model.base}/META-INF/persistence.xml" />
> >        </schematool>
> >
> > In fact, I looked in source code and this task has no set method for
> > "dropTables"argument.
> >
> >
> > Does anyone know why? or any way to work around it?
> >
> > I use :
> > revision.number=422266:683325
> > openjpa.version=1.2.0
> >
> > [1]
> >
> > http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/ref_guide_schema_schematool.html
> >
> > Thanks,
> >
> >
> > --
> > View this message in context:
> > http://n2.nabble.com/OpenJPA-1.2.0%3A-SchemaToolTask-does-not-have-%22dropTables%22-argument-tp2454421p2454421.html
> > Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >

-- 
                                                           Ted Leung
                                                           tedman@sfu.ca

It's time for a new bike when the bulb in your shift light burns out.

Re: OpenJPA-1.2.0: SchemaToolTask does not have "dropTables" argument

Posted by Donald Woods <dw...@apache.org>.
Patch has been attached to OPENJPA-970, based on your suggested changes.

Thanks,
Donald


Leonardo NOLETO wrote:
>  Thanks for your answers...
> 
> in fact, I found this problem because I want to use "refresh" action without
> drop my system tables that are in the same database...
> <schematool dropTables="false" action="refresh">
>             <fileset dir="${build.sql.dir}">
>                 <include name="schema.xml" />
>             </fileset>
>             <config
> propertiesFile="${prototype.src.model.base}/META-INF/persistence.xml" />
>         </schematool> 
> 
> I can temporarily resolve this problem by recompiling the source code and
> adding the set method on the class SchemaToolTask :
> 
>   public void setDropTables(boolean dropTables) {
>        flags.dropTables = dropTables;
>    }
> 
> 
> anyway I opened jira issue:
> https://issues.apache.org/jira/browse/OPENJPA-970
> 
> 
> 
> Michael Dick wrote:
>> I agree with Kevin, the missing argument for dropDB is a bug and should be
>> documented in a JIRA issue. If you don't have an account I'll go ahead and
>> open one on your behalf.
>>
>> To answer Tedman's questions :
>> DropDB is perhaps misnamed. I'd be very nervous about changing it to issue
>> drop DB ${DBNAME} on any database though ;-). I'd much rather rename it to
>> drop tables than change it.
>>
>> The difference between the MappingTool and SchemaTool is a little subtle.
>> The MappingTool primarily does Top Down mapping and either executes or
>> generates SQL. The SchemaTool can do other things like produce an xml
>> representation of a database. That xml representation can then be used by
>> other OpenJPA tools like the Mapping or ReverseMapping tool - this could
>> be
>> useful if your developer doesn't have read access to the production
>> database.
>>
>> Over time the lines between the two (or three) tools have blurred and
>> there's a bit of overlapping function. It's probably a good side project
>> to
>> do some analysis and cleanup, but it hasn't bubbled to the top of my list,
>> yet.
>>
>> -mike
>>
>>
>> On Tue, Mar 10, 2009 at 10:21 AM, Tedman Leung <te...@sfu.ca> wrote:
>>
>>> Incidentally, with the MappingToolTask, if you use schemaAction="dropDB",
>>> at least in MySql, you don't get a drop DB command, you get drop table
>>> commands, which sounds like what you're trying to do. I don't know if
>>> this
>>> applies to the schemaTool or what the difference between the MappingTool
>>> and SchemaTool is though.
>>>
>>> On Tue, Mar 10, 2009 at 10:12:04AM -0500, Kevin Sutter wrote:
>>>> Hi,
>>>> From what I can tell, this looks to be a blatant bug.  I can't find
>>> this
>>>> argument ever being implemented in past releases, but I only went back
>>> as
>>>> far as 1.0.x.  Please open a JIRA for this problem.
>>>>
>>>> As far as workarounds...  It depends on what your need is.  If you
>>> really
>>>> need to drop the tables, then you could either do it manually or use
>>> another
>>>> tool, such as the MappingTool.  Or, maybe one of the other options on
>>>> SchemaTool is sufficient like the actions of "deleteTableContents", or
>>>> "dropDB".
>>>>
>>>> Sorry for the inconvenience.
>>>> Kevin
>>>>
>>>> On Tue, Mar 10, 2009 at 5:37 AM, lfnoleto <lf...@genigraph.fr>
>>> wrote:
>>>>> Hi,
>>>>>
>>>>> I think this is a bug. The task SchemaToolTask does not implements
>>>>> "dropTables" argument. According to the documentation [1] this task
>>> can
>>>>> take "dropTables" arguments
>>>>> but when I run as shown below I get this error: The <schematool> type
>>>>> doesn't support the "droptables" attribute.
>>>>>
>>>>>    <schematool dropTables="true" action="retain">
>>>>>            <fileset dir="${build.sql.dir}">
>>>>>                <include name="schema.xml" />
>>>>>            </fileset>
>>>>>            <config
>>>>> propertiesFile="${prototype.src.model.base}/META-INF/persistence.xml"
>>> />
>>>>>        </schematool>
>>>>>
>>>>> In fact, I looked in source code and this task has no set method for
>>>>> "dropTables"argument.
>>>>>
>>>>>
>>>>> Does anyone know why? or any way to work around it?
>>>>>
>>>>> I use :
>>>>> revision.number=422266:683325
>>>>> openjpa.version=1.2.0
>>>>>
>>>>> [1]
>>>>>
>>>>>
>>> http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/ref_guide_schema_schematool.html
>>>>> Thanks,
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>>
>>> http://n2.nabble.com/OpenJPA-1.2.0%3A-SchemaToolTask-does-not-have-%22dropTables%22-argument-tp2454421p2454421.html
>>>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>>>>
>>> --
>>>                                                           Ted Leung
>>>                                                           tedman@sfu.ca
>>>
>>> It's time for a new bike when the bulb in your shift light burns out.
>>>
>>
> 

Re: OpenJPA-1.2.0: SchemaToolTask does not have "dropTables" argument

Posted by Leonardo NOLETO <lf...@genigraph.fr>.
 Thanks for your answers...

in fact, I found this problem because I want to use "refresh" action without
drop my system tables that are in the same database...
<schematool dropTables="false" action="refresh">
            <fileset dir="${build.sql.dir}">
                <include name="schema.xml" />
            </fileset>
            <config
propertiesFile="${prototype.src.model.base}/META-INF/persistence.xml" />
        </schematool> 

I can temporarily resolve this problem by recompiling the source code and
adding the set method on the class SchemaToolTask :

  public void setDropTables(boolean dropTables) {
       flags.dropTables = dropTables;
   }


anyway I opened jira issue:
https://issues.apache.org/jira/browse/OPENJPA-970



Michael Dick wrote:
> 
> I agree with Kevin, the missing argument for dropDB is a bug and should be
> documented in a JIRA issue. If you don't have an account I'll go ahead and
> open one on your behalf.
> 
> To answer Tedman's questions :
> DropDB is perhaps misnamed. I'd be very nervous about changing it to issue
> drop DB ${DBNAME} on any database though ;-). I'd much rather rename it to
> drop tables than change it.
> 
> The difference between the MappingTool and SchemaTool is a little subtle.
> The MappingTool primarily does Top Down mapping and either executes or
> generates SQL. The SchemaTool can do other things like produce an xml
> representation of a database. That xml representation can then be used by
> other OpenJPA tools like the Mapping or ReverseMapping tool - this could
> be
> useful if your developer doesn't have read access to the production
> database.
> 
> Over time the lines between the two (or three) tools have blurred and
> there's a bit of overlapping function. It's probably a good side project
> to
> do some analysis and cleanup, but it hasn't bubbled to the top of my list,
> yet.
> 
> -mike
> 
> 
> On Tue, Mar 10, 2009 at 10:21 AM, Tedman Leung <te...@sfu.ca> wrote:
> 
>> Incidentally, with the MappingToolTask, if you use schemaAction="dropDB",
>> at least in MySql, you don't get a drop DB command, you get drop table
>> commands, which sounds like what you're trying to do. I don't know if
>> this
>> applies to the schemaTool or what the difference between the MappingTool
>> and SchemaTool is though.
>>
>> On Tue, Mar 10, 2009 at 10:12:04AM -0500, Kevin Sutter wrote:
>> > Hi,
>> > From what I can tell, this looks to be a blatant bug.  I can't find
>> this
>> > argument ever being implemented in past releases, but I only went back
>> as
>> > far as 1.0.x.  Please open a JIRA for this problem.
>> >
>> > As far as workarounds...  It depends on what your need is.  If you
>> really
>> > need to drop the tables, then you could either do it manually or use
>> another
>> > tool, such as the MappingTool.  Or, maybe one of the other options on
>> > SchemaTool is sufficient like the actions of "deleteTableContents", or
>> > "dropDB".
>> >
>> > Sorry for the inconvenience.
>> > Kevin
>> >
>> > On Tue, Mar 10, 2009 at 5:37 AM, lfnoleto <lf...@genigraph.fr>
>> wrote:
>> >
>> > >
>> > > Hi,
>> > >
>> > > I think this is a bug. The task SchemaToolTask does not implements
>> > > "dropTables" argument. According to the documentation [1] this task
>> can
>> > > take "dropTables" arguments
>> > > but when I run as shown below I get this error: The <schematool> type
>> > > doesn't support the "droptables" attribute.
>> > >
>> > >    <schematool dropTables="true" action="retain">
>> > >            <fileset dir="${build.sql.dir}">
>> > >                <include name="schema.xml" />
>> > >            </fileset>
>> > >            <config
>> > > propertiesFile="${prototype.src.model.base}/META-INF/persistence.xml"
>> />
>> > >        </schematool>
>> > >
>> > > In fact, I looked in source code and this task has no set method for
>> > > "dropTables"argument.
>> > >
>> > >
>> > > Does anyone know why? or any way to work around it?
>> > >
>> > > I use :
>> > > revision.number=422266:683325
>> > > openjpa.version=1.2.0
>> > >
>> > > [1]
>> > >
>> > >
>> http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/ref_guide_schema_schematool.html
>> > >
>> > > Thanks,
>> > >
>> > >
>> > > --
>> > > View this message in context:
>> > >
>> http://n2.nabble.com/OpenJPA-1.2.0%3A-SchemaToolTask-does-not-have-%22dropTables%22-argument-tp2454421p2454421.html
>> > > Sent from the OpenJPA Users mailing list archive at Nabble.com.
>> > >
>>
>> --
>>                                                           Ted Leung
>>                                                           tedman@sfu.ca
>>
>> It's time for a new bike when the bulb in your shift light burns out.
>>
> 
> 

-- 
View this message in context: http://n2.nabble.com/OpenJPA-1.2.0%3A-SchemaToolTask-does-not-have-%22dropTables%22-argument-tp2454421p2456400.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: OpenJPA-1.2.0: SchemaToolTask does not have "dropTables" argument

Posted by Michael Dick <mi...@gmail.com>.
I agree with Kevin, the missing argument for dropDB is a bug and should be
documented in a JIRA issue. If you don't have an account I'll go ahead and
open one on your behalf.

To answer Tedman's questions :
DropDB is perhaps misnamed. I'd be very nervous about changing it to issue
drop DB ${DBNAME} on any database though ;-). I'd much rather rename it to
drop tables than change it.

The difference between the MappingTool and SchemaTool is a little subtle.
The MappingTool primarily does Top Down mapping and either executes or
generates SQL. The SchemaTool can do other things like produce an xml
representation of a database. That xml representation can then be used by
other OpenJPA tools like the Mapping or ReverseMapping tool - this could be
useful if your developer doesn't have read access to the production
database.

Over time the lines between the two (or three) tools have blurred and
there's a bit of overlapping function. It's probably a good side project to
do some analysis and cleanup, but it hasn't bubbled to the top of my list,
yet.

-mike


On Tue, Mar 10, 2009 at 10:21 AM, Tedman Leung <te...@sfu.ca> wrote:

> Incidentally, with the MappingToolTask, if you use schemaAction="dropDB",
> at least in MySql, you don't get a drop DB command, you get drop table
> commands, which sounds like what you're trying to do. I don't know if this
> applies to the schemaTool or what the difference between the MappingTool
> and SchemaTool is though.
>
> On Tue, Mar 10, 2009 at 10:12:04AM -0500, Kevin Sutter wrote:
> > Hi,
> > From what I can tell, this looks to be a blatant bug.  I can't find this
> > argument ever being implemented in past releases, but I only went back as
> > far as 1.0.x.  Please open a JIRA for this problem.
> >
> > As far as workarounds...  It depends on what your need is.  If you really
> > need to drop the tables, then you could either do it manually or use
> another
> > tool, such as the MappingTool.  Or, maybe one of the other options on
> > SchemaTool is sufficient like the actions of "deleteTableContents", or
> > "dropDB".
> >
> > Sorry for the inconvenience.
> > Kevin
> >
> > On Tue, Mar 10, 2009 at 5:37 AM, lfnoleto <lf...@genigraph.fr> wrote:
> >
> > >
> > > Hi,
> > >
> > > I think this is a bug. The task SchemaToolTask does not implements
> > > "dropTables" argument. According to the documentation [1] this task can
> > > take "dropTables" arguments
> > > but when I run as shown below I get this error: The <schematool> type
> > > doesn't support the "droptables" attribute.
> > >
> > >    <schematool dropTables="true" action="retain">
> > >            <fileset dir="${build.sql.dir}">
> > >                <include name="schema.xml" />
> > >            </fileset>
> > >            <config
> > > propertiesFile="${prototype.src.model.base}/META-INF/persistence.xml"
> />
> > >        </schematool>
> > >
> > > In fact, I looked in source code and this task has no set method for
> > > "dropTables"argument.
> > >
> > >
> > > Does anyone know why? or any way to work around it?
> > >
> > > I use :
> > > revision.number=422266:683325
> > > openjpa.version=1.2.0
> > >
> > > [1]
> > >
> > >
> http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/manual/ref_guide_schema_schematool.html
> > >
> > > Thanks,
> > >
> > >
> > > --
> > > View this message in context:
> > >
> http://n2.nabble.com/OpenJPA-1.2.0%3A-SchemaToolTask-does-not-have-%22dropTables%22-argument-tp2454421p2454421.html
> > > Sent from the OpenJPA Users mailing list archive at Nabble.com.
> > >
>
> --
>                                                           Ted Leung
>                                                           tedman@sfu.ca
>
> It's time for a new bike when the bulb in your shift light burns out.
>