You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by milotty <mi...@gmail.com> on 2008/04/03 02:48:01 UTC

about the initialization of DB2Dictionary

Hi,
Now I'm encountered a problem of NullPointerException like this:
java.lang.NullPointerException
     at
org.apache.openjpa.jdbc.sql.DB2Dictionary.isDB2ZOSV8xOrLater(DB2Dictionary.java:392)

     at
org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary(DB2Dictionary.java:784)

     at
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema(TableJDBCSeq.java:244)

     at
org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:609)

     at
org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(MappingTool.java:591)

     at
org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:477)
     at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:1075)
     at
org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java:197)

     at
org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)
     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)

     at org.apache.tools.ant.Task.perform(Task.java:364)
     at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:64)

     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)

     at org.apache.tools.ant.Task.perform(Task.java:364)

The scenario is I'm only using the ant task of MappingTool to build schema
for some JDO classes.
I looked into the source code a little. The problem is when
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema() invokes
org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary() to create
the index for the sequence table, the databaseProductVersion and/or
databaseProductName of DB2Dictionary are needed. But these 2 variables will
not be initialized until DB2Dictionary.connectedConfiguration() is invoked,
and it need a connection to the database. But in addSchema(), there isn't
any connection yet.
MappingTool doesn't always require a connection. So it should be wrong if
simply adding a connection before addSchema() invoked.

Could anyone give me any suggestion of this problem? How to resolve this
problem in OpenJPA scope? Or, is there any method from DB2 side can be used
to get databaseProductVersion and/or databaseProductName without a
connection to database?



Thanks,
Amy

RE: about the initialization of DB2Dictionary

Posted by Amy Yang <yy...@bea.com>.
Hi Catalina,
Thank you very much.



Thanks,
Amy
-----Original Message-----
From: catalina wei [mailto:catalina.wei@gmail.com] 
Sent: Thursday, April 03, 2008 8:14 AM
To: dev@openjpa.apache.org
Subject: Re: about the initialization of DB2Dictionary

Hi Amy,
I am thinking about taking the if (isDB2ZOSV8xOrLater())  checking out
from
createIndexIfNecessary() method.
I think all DB2 product supports unique index creation (will double
check
that),
so you might try this to see if index is auto created for you.

This kind of changes requires regression verification against various
versions of DB2 before committing such changes.

The null pointer avoidance is checked-in under OPENJPA-555.

Catalina

On 4/2/08, Amy Yang <mi...@gmail.com> wrote:
>
> Hi Catalina,
> Thank you for the quick response.
> As you mentioned, one approach is adding some null check to avoid the
NPE.
> And  some  warnings should be output to inform user about creating
index
> manually. And corresponding document for reference.
> Is there any possibility to automatically create the index without
> connection to database?
> By the way, I've opened a JIRA issue for this problem:
> https://issues.apache.org/jira/browse/OPENJPA-549
>
>
> Thanks,
> Amy
>
> 2008/4/2, catalina wei <ca...@gmail.com>:
>
> >
> > HI Amy,
> > Several methods in DB2Dictionary precondition is that
> > connectedConfiguration() is called so that databaseProductName and
> > databaseProductVersion are initialized.
> >
> > A quick fix for you is to modify isDB2... method to check for not
nulls,
> > for
> > example:
> >
> >
> >     public boolean isDB2UDBV82OrLater() {
> >         boolean match = false;
> >         if (databaseProductName != null &&
> >             (databaseProductVersion.indexOf("SQL") != -1
> >             || databaseProductName.indexOf("DB2/") != -1)
> >             && ((maj == 8 && min >= 2) || (maj >= 9)))
> >             match = true;
> >         return match;
> >     }
> >
> >     public boolean isDB2ZOSV8xOrLater() {
> >        boolean match = false;
> >        if (databaseProductName != null &&
> >            (databaseProductVersion.indexOf("DSN") != -1
> >            || databaseProductName.indexOf("DB2/") == -1)
> >            && maj >= 8)
> >            match = true;
> >         return match;
> >     }
> >
> >     public boolean isDB2ISeriesV5R3OrEarlier() {
> >        boolean match = false;
> >        if (databaseProductName != null &&
> >            databaseProductName.indexOf("AS") != -1
> >            && ((maj == 5 && min <=3) || maj < 5))
> >            match = true;
> >        return match;
> >     }
> >
> >     public boolean isDB2ISeriesV5R4OrLater() {
> >        boolean match = false;
> >        if (databaseProductName != null &&
> >            databaseProductName.indexOf("AS") != -1
> >            && (maj >=6 || (maj == 5 && min >=4)))
> >            match = true;
> >       return match;
> >     }
> >
> >     public boolean isDB2UDBV81OrEarlier() {
> >         boolean match = false;
> >         if (databaseProductName != null &&
> >             (databaseProductVersion.indexOf("SQL") != -1
> >             || databaseProductName.indexOf("DB2/") != -1) &&
> >             ((maj == 8 && min <= 1) || maj < 8))
> >             match = true;
> >         return match;
> >     }
> >
> >
> > This should resolve that  NullPointerExceiption, but requires user
to
> > manually create index if needed.
> >
> > If this fix works for you, I can commit the changes.
> >
> >
> > Catalina
> >
> > On 4/2/08, milotty <mi...@gmail.com> wrote:
> > >
> > > Hi,
> > > Now I'm encountered a problem of NullPointerException like this:
> > > java.lang.NullPointerException
> > >      at
> > > org.apache.openjpa.jdbc.sql.DB2Dictionary.isDB2ZOSV8xOrLater(
> > > DB2Dictionary.java:392)
> > >
> > >      at
> > > org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary(
> > > DB2Dictionary.java:784)
> > >
> > >      at
> > >
>
org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema(TableJDBCSeq.java
> > > :244)
> > >
> > >      at
> > > org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(
> > > MappingTool.java:609)
> > >
> > >      at
> > > org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(
> > > MappingTool.java:591)
> > >
> > >      at
> > >
org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:477)
> > >      at
org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java
> > > :1075)
> > >      at
> > >
> >
>
org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.ja
va
> > > :197)
> > >
> > >      at
> > >
org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)
> > >      at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> > > :275)
> > >
> > >      at org.apache.tools.ant.Task.perform(Task.java:364)
> > >      at
> org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java
> > > :64)
> > >
> > >      at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> > > :275)
> > >
> > >      at org.apache.tools.ant.Task.perform(Task.java:364)
> > >
> > > The scenario is I'm only using the ant task of MappingTool to
build
> > schema
> > > for some JDO classes.
> > > I looked into the source code a little. The problem is when
> > > org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema() invokes
> > > org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary()
to
> > > create
> > > the index for the sequence table, the databaseProductVersion
and/or
> > > databaseProductName of DB2Dictionary are needed. But these 2
variables
> > > will
> > > not be initialized until DB2Dictionary.connectedConfiguration() is
> > > invoked,
> > > and it need a connection to the database. But in addSchema(),
there
> > isn't
> > > any connection yet.
> > > MappingTool doesn't always require a connection. So it should be
wrong
> > if
> > > simply adding a connection before addSchema() invoked.
> > >
> > > Could anyone give me any suggestion of this problem? How to
resolve
> this
> > > problem in OpenJPA scope? Or, is there any method from DB2 side
can be
> > > used
> > > to get databaseProductVersion and/or databaseProductName without a
> > > connection to database?
> > >
> > >
> > >
> > > Thanks,
> > > Amy
> > >
> >
>

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

Re: about the initialization of DB2Dictionary

Posted by catalina wei <ca...@gmail.com>.
Hi Amy,
I am thinking about taking the if (isDB2ZOSV8xOrLater())  checking out from
createIndexIfNecessary() method.
I think all DB2 product supports unique index creation (will double check
that),
so you might try this to see if index is auto created for you.

This kind of changes requires regression verification against various
versions of DB2 before committing such changes.

The null pointer avoidance is checked-in under OPENJPA-555.

Catalina

On 4/2/08, Amy Yang <mi...@gmail.com> wrote:
>
> Hi Catalina,
> Thank you for the quick response.
> As you mentioned, one approach is adding some null check to avoid the NPE.
> And  some  warnings should be output to inform user about creating index
> manually. And corresponding document for reference.
> Is there any possibility to automatically create the index without
> connection to database?
> By the way, I've opened a JIRA issue for this problem:
> https://issues.apache.org/jira/browse/OPENJPA-549
>
>
> Thanks,
> Amy
>
> 2008/4/2, catalina wei <ca...@gmail.com>:
>
> >
> > HI Amy,
> > Several methods in DB2Dictionary precondition is that
> > connectedConfiguration() is called so that databaseProductName and
> > databaseProductVersion are initialized.
> >
> > A quick fix for you is to modify isDB2... method to check for not nulls,
> > for
> > example:
> >
> >
> >     public boolean isDB2UDBV82OrLater() {
> >         boolean match = false;
> >         if (databaseProductName != null &&
> >             (databaseProductVersion.indexOf("SQL") != -1
> >             || databaseProductName.indexOf("DB2/") != -1)
> >             && ((maj == 8 && min >= 2) || (maj >= 9)))
> >             match = true;
> >         return match;
> >     }
> >
> >     public boolean isDB2ZOSV8xOrLater() {
> >        boolean match = false;
> >        if (databaseProductName != null &&
> >            (databaseProductVersion.indexOf("DSN") != -1
> >            || databaseProductName.indexOf("DB2/") == -1)
> >            && maj >= 8)
> >            match = true;
> >         return match;
> >     }
> >
> >     public boolean isDB2ISeriesV5R3OrEarlier() {
> >        boolean match = false;
> >        if (databaseProductName != null &&
> >            databaseProductName.indexOf("AS") != -1
> >            && ((maj == 5 && min <=3) || maj < 5))
> >            match = true;
> >        return match;
> >     }
> >
> >     public boolean isDB2ISeriesV5R4OrLater() {
> >        boolean match = false;
> >        if (databaseProductName != null &&
> >            databaseProductName.indexOf("AS") != -1
> >            && (maj >=6 || (maj == 5 && min >=4)))
> >            match = true;
> >       return match;
> >     }
> >
> >     public boolean isDB2UDBV81OrEarlier() {
> >         boolean match = false;
> >         if (databaseProductName != null &&
> >             (databaseProductVersion.indexOf("SQL") != -1
> >             || databaseProductName.indexOf("DB2/") != -1) &&
> >             ((maj == 8 && min <= 1) || maj < 8))
> >             match = true;
> >         return match;
> >     }
> >
> >
> > This should resolve that  NullPointerExceiption, but requires user to
> > manually create index if needed.
> >
> > If this fix works for you, I can commit the changes.
> >
> >
> > Catalina
> >
> > On 4/2/08, milotty <mi...@gmail.com> wrote:
> > >
> > > Hi,
> > > Now I'm encountered a problem of NullPointerException like this:
> > > java.lang.NullPointerException
> > >      at
> > > org.apache.openjpa.jdbc.sql.DB2Dictionary.isDB2ZOSV8xOrLater(
> > > DB2Dictionary.java:392)
> > >
> > >      at
> > > org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary(
> > > DB2Dictionary.java:784)
> > >
> > >      at
> > >
> org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema(TableJDBCSeq.java
> > > :244)
> > >
> > >      at
> > > org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(
> > > MappingTool.java:609)
> > >
> > >      at
> > > org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(
> > > MappingTool.java:591)
> > >
> > >      at
> > > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:477)
> > >      at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java
> > > :1075)
> > >      at
> > >
> >
> org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java
> > > :197)
> > >
> > >      at
> > > org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)
> > >      at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> > > :275)
> > >
> > >      at org.apache.tools.ant.Task.perform(Task.java:364)
> > >      at
> org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java
> > > :64)
> > >
> > >      at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> > > :275)
> > >
> > >      at org.apache.tools.ant.Task.perform(Task.java:364)
> > >
> > > The scenario is I'm only using the ant task of MappingTool to build
> > schema
> > > for some JDO classes.
> > > I looked into the source code a little. The problem is when
> > > org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema() invokes
> > > org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary() to
> > > create
> > > the index for the sequence table, the databaseProductVersion and/or
> > > databaseProductName of DB2Dictionary are needed. But these 2 variables
> > > will
> > > not be initialized until DB2Dictionary.connectedConfiguration() is
> > > invoked,
> > > and it need a connection to the database. But in addSchema(), there
> > isn't
> > > any connection yet.
> > > MappingTool doesn't always require a connection. So it should be wrong
> > if
> > > simply adding a connection before addSchema() invoked.
> > >
> > > Could anyone give me any suggestion of this problem? How to resolve
> this
> > > problem in OpenJPA scope? Or, is there any method from DB2 side can be
> > > used
> > > to get databaseProductVersion and/or databaseProductName without a
> > > connection to database?
> > >
> > >
> > >
> > > Thanks,
> > > Amy
> > >
> >
>

Re: about the initialization of DB2Dictionary

Posted by Amy Yang <mi...@gmail.com>.
Hi Catalina,
Thank you for the quick response.
As you mentioned, one approach is adding some null check to avoid the NPE.
And  some  warnings should be output to inform user about creating index
manually. And corresponding document for reference.
Is there any possibility to automatically create the index without
connection to database?
By the way, I've opened a JIRA issue for this problem:
https://issues.apache.org/jira/browse/OPENJPA-549


Thanks,
Amy

2008/4/2, catalina wei <ca...@gmail.com>:
>
> HI Amy,
> Several methods in DB2Dictionary precondition is that
> connectedConfiguration() is called so that databaseProductName and
> databaseProductVersion are initialized.
>
> A quick fix for you is to modify isDB2... method to check for not nulls,
> for
> example:
>
>
>     public boolean isDB2UDBV82OrLater() {
>         boolean match = false;
>         if (databaseProductName != null &&
>             (databaseProductVersion.indexOf("SQL") != -1
>             || databaseProductName.indexOf("DB2/") != -1)
>             && ((maj == 8 && min >= 2) || (maj >= 9)))
>             match = true;
>         return match;
>     }
>
>     public boolean isDB2ZOSV8xOrLater() {
>        boolean match = false;
>        if (databaseProductName != null &&
>            (databaseProductVersion.indexOf("DSN") != -1
>            || databaseProductName.indexOf("DB2/") == -1)
>            && maj >= 8)
>            match = true;
>         return match;
>     }
>
>     public boolean isDB2ISeriesV5R3OrEarlier() {
>        boolean match = false;
>        if (databaseProductName != null &&
>            databaseProductName.indexOf("AS") != -1
>            && ((maj == 5 && min <=3) || maj < 5))
>            match = true;
>        return match;
>     }
>
>     public boolean isDB2ISeriesV5R4OrLater() {
>        boolean match = false;
>        if (databaseProductName != null &&
>            databaseProductName.indexOf("AS") != -1
>            && (maj >=6 || (maj == 5 && min >=4)))
>            match = true;
>       return match;
>     }
>
>     public boolean isDB2UDBV81OrEarlier() {
>         boolean match = false;
>         if (databaseProductName != null &&
>             (databaseProductVersion.indexOf("SQL") != -1
>             || databaseProductName.indexOf("DB2/") != -1) &&
>             ((maj == 8 && min <= 1) || maj < 8))
>             match = true;
>         return match;
>     }
>
>
> This should resolve that  NullPointerExceiption, but requires user to
> manually create index if needed.
>
> If this fix works for you, I can commit the changes.
>
>
> Catalina
>
> On 4/2/08, milotty <mi...@gmail.com> wrote:
> >
> > Hi,
> > Now I'm encountered a problem of NullPointerException like this:
> > java.lang.NullPointerException
> >      at
> > org.apache.openjpa.jdbc.sql.DB2Dictionary.isDB2ZOSV8xOrLater(
> > DB2Dictionary.java:392)
> >
> >      at
> > org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary(
> > DB2Dictionary.java:784)
> >
> >      at
> > org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema(TableJDBCSeq.java
> > :244)
> >
> >      at
> > org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(
> > MappingTool.java:609)
> >
> >      at
> > org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(
> > MappingTool.java:591)
> >
> >      at
> > org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:477)
> >      at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java
> > :1075)
> >      at
> >
> org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java
> > :197)
> >
> >      at
> > org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)
> >      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> > :275)
> >
> >      at org.apache.tools.ant.Task.perform(Task.java:364)
> >      at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java
> > :64)
> >
> >      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> > :275)
> >
> >      at org.apache.tools.ant.Task.perform(Task.java:364)
> >
> > The scenario is I'm only using the ant task of MappingTool to build
> schema
> > for some JDO classes.
> > I looked into the source code a little. The problem is when
> > org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema() invokes
> > org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary() to
> > create
> > the index for the sequence table, the databaseProductVersion and/or
> > databaseProductName of DB2Dictionary are needed. But these 2 variables
> > will
> > not be initialized until DB2Dictionary.connectedConfiguration() is
> > invoked,
> > and it need a connection to the database. But in addSchema(), there
> isn't
> > any connection yet.
> > MappingTool doesn't always require a connection. So it should be wrong
> if
> > simply adding a connection before addSchema() invoked.
> >
> > Could anyone give me any suggestion of this problem? How to resolve this
> > problem in OpenJPA scope? Or, is there any method from DB2 side can be
> > used
> > to get databaseProductVersion and/or databaseProductName without a
> > connection to database?
> >
> >
> >
> > Thanks,
> > Amy
> >
>

Re: about the initialization of DB2Dictionary

Posted by catalina wei <ca...@gmail.com>.
HI Amy,
Several methods in DB2Dictionary precondition is that
connectedConfiguration() is called so that databaseProductName and
databaseProductVersion are initialized.

A quick fix for you is to modify isDB2... method to check for not nulls, for
example:


    public boolean isDB2UDBV82OrLater() {
        boolean match = false;
        if (databaseProductName != null &&
            (databaseProductVersion.indexOf("SQL") != -1
            || databaseProductName.indexOf("DB2/") != -1)
            && ((maj == 8 && min >= 2) || (maj >= 9)))
            match = true;
        return match;
    }

    public boolean isDB2ZOSV8xOrLater() {
       boolean match = false;
       if (databaseProductName != null &&
           (databaseProductVersion.indexOf("DSN") != -1
           || databaseProductName.indexOf("DB2/") == -1)
           && maj >= 8)
           match = true;
        return match;
    }

    public boolean isDB2ISeriesV5R3OrEarlier() {
       boolean match = false;
       if (databaseProductName != null &&
           databaseProductName.indexOf("AS") != -1
           && ((maj == 5 && min <=3) || maj < 5))
           match = true;
       return match;
    }

    public boolean isDB2ISeriesV5R4OrLater() {
       boolean match = false;
       if (databaseProductName != null &&
           databaseProductName.indexOf("AS") != -1
           && (maj >=6 || (maj == 5 && min >=4)))
           match = true;
      return match;
    }

    public boolean isDB2UDBV81OrEarlier() {
        boolean match = false;
        if (databaseProductName != null &&
            (databaseProductVersion.indexOf("SQL") != -1
            || databaseProductName.indexOf("DB2/") != -1) &&
            ((maj == 8 && min <= 1) || maj < 8))
            match = true;
        return match;
    }


This should resolve that  NullPointerExceiption, but requires user to
manually create index if needed.

If this fix works for you, I can commit the changes.

Catalina
On 4/2/08, milotty <mi...@gmail.com> wrote:
>
> Hi,
> Now I'm encountered a problem of NullPointerException like this:
> java.lang.NullPointerException
>      at
> org.apache.openjpa.jdbc.sql.DB2Dictionary.isDB2ZOSV8xOrLater(
> DB2Dictionary.java:392)
>
>      at
> org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary(
> DB2Dictionary.java:784)
>
>      at
> org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema(TableJDBCSeq.java
> :244)
>
>      at
> org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(
> MappingTool.java:609)
>
>      at
> org.apache.openjpa.jdbc.meta.MappingTool.addSequenceComponents(
> MappingTool.java:591)
>
>      at
> org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:477)
>      at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java
> :1075)
>      at
> org.apache.openjpa.jdbc.ant.MappingToolTask.executeOn(MappingToolTask.java
> :197)
>
>      at
> org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)
>      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> :275)
>
>      at org.apache.tools.ant.Task.perform(Task.java:364)
>      at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java
> :64)
>
>      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java
> :275)
>
>      at org.apache.tools.ant.Task.perform(Task.java:364)
>
> The scenario is I'm only using the ant task of MappingTool to build schema
> for some JDO classes.
> I looked into the source code a little. The problem is when
> org.apache.openjpa.jdbc.kernel.TableJDBCSeq.addSchema() invokes
> org.apache.openjpa.jdbc.sql.DB2Dictionary.createIndexIfNecessary() to
> create
> the index for the sequence table, the databaseProductVersion and/or
> databaseProductName of DB2Dictionary are needed. But these 2 variables
> will
> not be initialized until DB2Dictionary.connectedConfiguration() is
> invoked,
> and it need a connection to the database. But in addSchema(), there isn't
> any connection yet.
> MappingTool doesn't always require a connection. So it should be wrong if
> simply adding a connection before addSchema() invoked.
>
> Could anyone give me any suggestion of this problem? How to resolve this
> problem in OpenJPA scope? Or, is there any method from DB2 side can be
> used
> to get databaseProductVersion and/or databaseProductName without a
> connection to database?
>
>
>
> Thanks,
> Amy
>