You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Laird Nelson (JIRA)" <ji...@apache.org> on 2010/02/25 16:52:28 UTC

[jira] Created: (OPENJPA-1537) SchemaGenerator interacts poorly with InformixDictionary

SchemaGenerator interacts poorly with InformixDictionary
--------------------------------------------------------

                 Key: OPENJPA-1537
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1537
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc, sql
    Affects Versions: 2.0.0-beta
            Reporter: Laird Nelson


If you ask the SchemaGenerator to generate schemas like this:

sg.generateSchemas(new DBIdentifier[] { DBIdentifier.newTable("informix.foobar_table") });

...then identifiers within the SchemaGenerator--whether of tables, primary keys, foreign keys, what have you--contain quotes.

Quoted identifiers are then subsequently not trimmed, because the space padding occurs inside the quotes.

This means the SchemaGroup will, for example, never find the Schema identified by the user at generateSchemas()-call-time.  Consequently no foreign keys will be generated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1537) SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)

Posted by "Jeremy Bauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12839740#action_12839740 ] 

Jeremy Bauer commented on OPENJPA-1537:
---------------------------------------

Hi Laird.  Identifiers aren't necessarily equal if delimiters are removed.  It depends on how they are stored in the DB (mixed, upper, or lower case).  With DB2, for example, "informix" != informix, since the delimited name will actually be stored in lower case (mixed, actually) and will require delimiters in the SQL to indicate the proper identifier.  The good news is that the DBIdentifier code is reasonably flexible/configurable so my hope is that these Informix issues can be fixed by flipping a few switches.

If you could supply small test cases that would really help.  I just about have my informix system back up and running and will be looking at these issues shortly.

> SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)
> --------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1537
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1537
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, sql
>    Affects Versions: 2.0.0-beta
>            Reporter: Laird Nelson
>            Assignee: Jeremy Bauer
>
> If you ask the SchemaGenerator to generate schemas like this:
> sg.generateSchemas(new DBIdentifier[] { DBIdentifier.newTable("informix.foobar_table") });
> ...then identifiers within the SchemaGenerator--whether of tables, primary keys, foreign keys, what have you--contain quotes.
> Quoted identifiers are then subsequently not trimmed, because the space padding occurs inside the quotes.
> This means the SchemaGroup will, for example, never find the Schema identified by the user at generateSchemas()-call-time.  Consequently no foreign keys will be generated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-1537) SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1537?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Laird Nelson updated OPENJPA-1537:
----------------------------------

    Summary: SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)  (was: SchemaGenerator interacts poorly with InformixDictionary)

> SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)
> --------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1537
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1537
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, sql
>    Affects Versions: 2.0.0-beta
>            Reporter: Laird Nelson
>
> If you ask the SchemaGenerator to generate schemas like this:
> sg.generateSchemas(new DBIdentifier[] { DBIdentifier.newTable("informix.foobar_table") });
> ...then identifiers within the SchemaGenerator--whether of tables, primary keys, foreign keys, what have you--contain quotes.
> Quoted identifiers are then subsequently not trimmed, because the space padding occurs inside the quotes.
> This means the SchemaGroup will, for example, never find the Schema identified by the user at generateSchemas()-call-time.  Consequently no foreign keys will be generated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1537) SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838418#action_12838418 ] 

Laird Nelson commented on OPENJPA-1537:
---------------------------------------

One workaround for the SchemaGenerator case is to subclass the Informix dictionary and make it pretend that it doesn't support delimited identifiers (dict.supportsDelimitedIdentifiers = false).  But that seems like solving the problem with a howitzer.

Additionally, you need to supply a DBIdentifierUtil whose fromDBName() method first trim()s the incoming name, since even if the dictionary doesn't support delimited identifiers, it will quote the name anyhow if it has space padding in it.

trimSchemaNames appears to have no effect--i.e. it isn't consulted before the name is passed to fromDBName(), so that's not an avenue for working around the problem.

> SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)
> --------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1537
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1537
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, sql
>    Affects Versions: 2.0.0-beta
>            Reporter: Laird Nelson
>            Assignee: Jeremy Bauer
>
> If you ask the SchemaGenerator to generate schemas like this:
> sg.generateSchemas(new DBIdentifier[] { DBIdentifier.newTable("informix.foobar_table") });
> ...then identifiers within the SchemaGenerator--whether of tables, primary keys, foreign keys, what have you--contain quotes.
> Quoted identifiers are then subsequently not trimmed, because the space padding occurs inside the quotes.
> This means the SchemaGroup will, for example, never find the Schema identified by the user at generateSchemas()-call-time.  Consequently no foreign keys will be generated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1537) SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838431#action_12838431 ] 

Laird Nelson commented on OPENJPA-1537:
---------------------------------------

Sure, Jeremy.

IMHO--and granted it's very, very H since I don't know the codebase--two identifiers should be equal to each other when their delimiters are removed.  That would solve what I suspect will be a whole class of errors.

That is, if "informix" were equal to informix.

Trimming and whitespace are a little more difficult--although my naive suspicion here is that *identifiers* with trailing spaces don't exist.  If my suspicion is correct, then we might be able to solve this by also saying that two identifiers are equal when their delimiters-removed, trimmed names are equal.

That is, "informix     " should equal informix.

(I'm going to file some more bugs related to what happens when an identifier produced by the DBDictionary makes its way into an XML schema output by XMLSchemaSerializer.  Hint: you get things like <column name="&quot;foobar_column&quot;">, which, after reverse mapping, ends up as: @Column(name=""foobar_column""), which doesn't compile.  Are you the guy who will get these as well?)

> SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)
> --------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1537
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1537
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, sql
>    Affects Versions: 2.0.0-beta
>            Reporter: Laird Nelson
>            Assignee: Jeremy Bauer
>
> If you ask the SchemaGenerator to generate schemas like this:
> sg.generateSchemas(new DBIdentifier[] { DBIdentifier.newTable("informix.foobar_table") });
> ...then identifiers within the SchemaGenerator--whether of tables, primary keys, foreign keys, what have you--contain quotes.
> Quoted identifiers are then subsequently not trimmed, because the space padding occurs inside the quotes.
> This means the SchemaGroup will, for example, never find the Schema identified by the user at generateSchemas()-call-time.  Consequently no foreign keys will be generated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (OPENJPA-1537) SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)

Posted by "Jeremy Bauer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1537?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Bauer reassigned OPENJPA-1537:
-------------------------------------

    Assignee: Jeremy Bauer

> SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)
> --------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1537
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1537
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, sql
>    Affects Versions: 2.0.0-beta
>            Reporter: Laird Nelson
>            Assignee: Jeremy Bauer
>
> If you ask the SchemaGenerator to generate schemas like this:
> sg.generateSchemas(new DBIdentifier[] { DBIdentifier.newTable("informix.foobar_table") });
> ...then identifiers within the SchemaGenerator--whether of tables, primary keys, foreign keys, what have you--contain quotes.
> Quoted identifiers are then subsequently not trimmed, because the space padding occurs inside the quotes.
> This means the SchemaGroup will, for example, never find the Schema identified by the user at generateSchemas()-call-time.  Consequently no foreign keys will be generated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1537) SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)

Posted by "Jeremy Bauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838415#action_12838415 ] 

Jeremy Bauer commented on OPENJPA-1537:
---------------------------------------

Thanks for reporting this bug, Laird.  There were many naming/identifier related changes from 1.2.x to 2.0/trunk.  I'll take a look at it within the next day or two.

> SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)
> --------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1537
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1537
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, sql
>    Affects Versions: 2.0.0-beta
>            Reporter: Laird Nelson
>            Assignee: Jeremy Bauer
>
> If you ask the SchemaGenerator to generate schemas like this:
> sg.generateSchemas(new DBIdentifier[] { DBIdentifier.newTable("informix.foobar_table") });
> ...then identifiers within the SchemaGenerator--whether of tables, primary keys, foreign keys, what have you--contain quotes.
> Quoted identifiers are then subsequently not trimmed, because the space padding occurs inside the quotes.
> This means the SchemaGroup will, for example, never find the Schema identified by the user at generateSchemas()-call-time.  Consequently no foreign keys will be generated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OPENJPA-1537) SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)

Posted by "Laird Nelson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838449#action_12838449 ] 

Laird Nelson commented on OPENJPA-1537:
---------------------------------------

Interestingly, the workaround I describe--brute force removing the delimiters, essentially, by saying the DBDictionary doesn't support them, and by supplying a DBIdentifierUtil that trims incoming names in its fromDBName() method--doesn't work for names that are, for example, numbers.

I have some indices in my Informix database whose names are, e.g., 378_8804.

These show up in my XML schema files--after my workaround, which gets around most instances of this bug--like this:

            <index name="&quot;378_8804&quot;" unique="true">

Note the &quot; bits, even though my DBDictionary is reporting that it does not support delimited identifiers.

> SchemaGenerator interacts poorly with InformixDictionary (regression from 1.2.2)
> --------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1537
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1537
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, sql
>    Affects Versions: 2.0.0-beta
>            Reporter: Laird Nelson
>            Assignee: Jeremy Bauer
>
> If you ask the SchemaGenerator to generate schemas like this:
> sg.generateSchemas(new DBIdentifier[] { DBIdentifier.newTable("informix.foobar_table") });
> ...then identifiers within the SchemaGenerator--whether of tables, primary keys, foreign keys, what have you--contain quotes.
> Quoted identifiers are then subsequently not trimmed, because the space padding occurs inside the quotes.
> This means the SchemaGroup will, for example, never find the Schema identified by the user at generateSchemas()-call-time.  Consequently no foreign keys will be generated.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.