You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Alan Raison <Al...@luminary.co.uk> on 2009/01/22 11:59:39 UTC

OpenJPA 1.2.0 Test Cases - Table Name too Long

Hi

 

I have been writing a DBDictionary for the Ingres database and have been
running the test cases.  Ingres supports 32 character table names, and
this has been set in the dictionary.  However some tests have hit an
error whereby the table name is too long for the database.

 

I notice in the DBDictionary class there is a method called
"getValidTableName" but this clearly isn't being used since it is trying
to use a table name which is too long.  Other databases (such as Oracle)
also have quite a short maximum length for table names, so this problem
must be able to overcome, but I can't see anything in other Dictionary
classes.

 

Is there anything special I should be doing to run the tests?  I am
currently running through mvn test.

 

My draft DBDictionary class is attached along with a sample surefire
report (with my username and password removed!)

Alan

Alan Raison

 


Re: OpenJPA 1.2.0 Test Cases - Table Name too Long

Posted by Michael Dick <mi...@gmail.com>.
Hi Alan,

I'm afraid I haven't been able to get to the bottom of this yet, but I've
opened a JIRA issue on your behalf, OPENJPA-866 [1].

If you have a JIRA ID let me know and I'm make you the originator, you'll
get automatic notification that way.

Sorry this wasn't a trivial fix (or if it was I missed it).

Best Regards,
-mike

[1] https://issues.apache.org/jira/browse/OPENJPA-866

On Thu, Jan 22, 2009 at 8:39 AM, Michael Dick <mi...@gmail.com>wrote:

> You're right, I just reproduced it with oracle (running in Eclipse). Looks
> like SynchronizeMappings isn't going through the Dictionary to trim the
> table name. I'll take a closer look.
>
> Thanks for pointing it out.
>
> -mike
>
>
> On Thu, Jan 22, 2009 at 8:22 AM, Alan Raison <Al...@luminary.co.uk>wrote:
>
>> > I think you're looking for DBDictionary.maxTableNameLength. It's
>> usually
>> > set in the constructor for the DBDictionary class, ie in
>> > OracleDictionary :
>>
>> I have already set this property in my Dictionary, but somehow openjpa
>> is creating a table name which is too long and then trapping the error
>> itself during the getCreateTableSQL method.  Note the error text from
>> the sample Test output XML sent previously:
>>
>> "Table name "PersistentMapHolder_testPCIntfKeyPCValue" is 40-character
>> long. The database allows maximum 32-character for a table name."
>>
>> This has correctly identified that maxTableNameLength is 32, so do I
>> need to do something else to ensure that openjpa doesn't try to create a
>> Table object with a 40-character name?
>>
>> Thanks
>>
>> Alan
>>
>
>

Re: OpenJPA 1.2.0 Test Cases - Table Name too Long

Posted by Michael Dick <mi...@gmail.com>.
You're right, I just reproduced it with oracle (running in Eclipse). Looks
like SynchronizeMappings isn't going through the Dictionary to trim the
table name. I'll take a closer look.

Thanks for pointing it out.

-mike

On Thu, Jan 22, 2009 at 8:22 AM, Alan Raison <Al...@luminary.co.uk>wrote:

> > I think you're looking for DBDictionary.maxTableNameLength. It's
> usually
> > set in the constructor for the DBDictionary class, ie in
> > OracleDictionary :
>
> I have already set this property in my Dictionary, but somehow openjpa
> is creating a table name which is too long and then trapping the error
> itself during the getCreateTableSQL method.  Note the error text from
> the sample Test output XML sent previously:
>
> "Table name "PersistentMapHolder_testPCIntfKeyPCValue" is 40-character
> long. The database allows maximum 32-character for a table name."
>
> This has correctly identified that maxTableNameLength is 32, so do I
> need to do something else to ensure that openjpa doesn't try to create a
> Table object with a 40-character name?
>
> Thanks
>
> Alan
>

RE: OpenJPA 1.2.0 Test Cases - Table Name too Long

Posted by Alan Raison <Al...@luminary.co.uk>.
> I think you're looking for DBDictionary.maxTableNameLength. It's
usually  
> set in the constructor for the DBDictionary class, ie in 
> OracleDictionary :

I have already set this property in my Dictionary, but somehow openjpa
is creating a table name which is too long and then trapping the error
itself during the getCreateTableSQL method.  Note the error text from
the sample Test output XML sent previously:

"Table name "PersistentMapHolder_testPCIntfKeyPCValue" is 40-character
long. The database allows maximum 32-character for a table name."

This has correctly identified that maxTableNameLength is 32, so do I
need to do something else to ensure that openjpa doesn't try to create a
Table object with a 40-character name?

Thanks

Alan

Re: OpenJPA 1.2.0 Test Cases - Table Name too Long

Posted by Michael Dick <mi...@apache.org>.
Hi Alan,

I think you're looking for DBDictionary.maxTableNameLength. It's usually set
in the constructor for the DBDictionary class, ie in OracleDictionary :
 public OracleDictionary() {
        <snip>
        maxTableNameLength = 30;
        maxColumnNameLength = 30;
        maxIndexNameLength = 30;
        maxConstraintNameLength = 30;
        maxEmbeddedBlobSize = 4000;
        maxEmbeddedClobSize = 4000;
       <snip>
}

Adding something similar to your IngressDBDictionary should resolve the
problem.

Regarding running the tests running through maven is fine. You may need to
use the test-custom profile (unless you hack about with pom.xml).

Hope this helps,

-mike

On Thu, Jan 22, 2009 at 4:59 AM, Alan Raison <Al...@luminary.co.uk>wrote:

>  Hi
>
>
>
> I have been writing a DBDictionary for the Ingres database and have been
> running the test cases.  Ingres supports 32 character table names, and this
> has been set in the dictionary.  However some tests have hit an error
> whereby the table name is too long for the database.
>
>
>
> I notice in the DBDictionary class there is a method called
> "getValidTableName" but this clearly isn't being used since it is trying to
> use a table name which is too long.  Other databases (such as Oracle) also
> have quite a short maximum length for table names, so this problem must be
> able to overcome, but I can't see anything in other Dictionary classes.
>
>
>
> Is there anything special I should be doing to run the tests?  I am
> currently running through mvn test.
>
>
>
> My draft DBDictionary class is attached along with a sample surefire report
> (with my username and password removed!)
>
> Alan
>
> *Alan Raison*
>
>
>