openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl PIhlblad (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2086) OracleDictionary setFixed and setFormOfUse(NCLOB) are not really doing what they should.
Date Sat, 10 Dec 2011 12:03:39 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166845#comment-13166845
] 

Karl PIhlblad commented on OPENJPA-2086:
----------------------------------------

After some more investigation, it seems as if defaultNChar=true is not a good strategy,
as it prevents  Oracle's optimizer to use  char/varchar indexes for nchar parameters. Sigh...

Using @Column(columnDefinition) is then perhaps the only solution but that will fail for constructs
when comparing against functions:
eg; param =  UPPER( col ),    param = TRIM( col), etc.   

However, unless a better solution is available, I think the conclusion is to stick with columnDefinition,
and convert the database character if neccesary...

Also,  unfortunately, setObject() seems to be depending on what PreparedStatement implementation
is used. On WebSphere, WsPreparedStatment, or perhaps the 
WebSphere variant of OracleDictionary fails to get the 'fixed' semantics right. Again, I suppose
using the columnDefinition is the best shot...



 
                
> OracleDictionary  setFixed and setFormOfUse(NCLOB) are not really doing what they should.
> -----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2086
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2086
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.1.1, 2.2.0
>         Environment: Oracle 9g, 10g and 11g
>            Reporter: Karl PIhlblad
>            Priority: Minor
>              Labels: charset, nchar, openjpa, oracle
>
> The setString() method in the OracleDictionary tries to be smart and and look up the
column type, and detect and apply nchar and/or fixed char semantics.
> However, I believe that the type information is normally not present for queries, and
the functions are never called.
> That means that characters outside the database character set will be lost during translation,
and that comparison on CHAR (fixed length) columns will not match if 
> the arguments are not padded to the column length.
>  
> I suggest that the special nchar handling is removed as it is not working properly. The
only "reliable" option is to set the connection property oracle.jdbc.defaultNChar=true,
> as it would be neigh impossible to get this right in an automatic way.
> (Actually, the sensible option is to convert the database to AL32UTF8, and not use nchars
at all since Oracles nchar handling seems to be problematic. )
> Further as the fixedString handling also does not work without type information, the
dictionary could either always, or depending on a flag,  
> call the setFixedChar() method, or just rely on the connection parameter "fixedString"
(and use setObject), avoiding the complexity (and the cost of reflection calls)  altogether.
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message