openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-745) Sybase by default silently truncates a string which is longer than the column length without raising an exception
Date Mon, 20 Oct 2008 22:28:44 GMT

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

Michael Dick commented on OPENJPA-745:
--------------------------------------

Shouldn't : 
--- openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java	(revision
706319)
+++ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java	(working
copy)
@@ -920,6 +920,7 @@
        try {
            // connect if the connection is currently null, or if
            // the connection has been closed out from under us
            if (_conn == null)
                 _conn = connectInternal();
             if (ref)
                 _conn.ref();
+            _dict.initializeSettings(_conn);
         } catch (SQLException se) {
             throw SQLExceptions.getStore(se, _dict);
         } finally {


actually be 
        try {
            // connect if the connection is currently null, or if
            // the connection has been closed out from under us
-            if (_conn == null) 
+            if (_conn == null) {
                 _conn = connectInternal();
+                _dict.initializeSettings(_conn);
+           }
             if (ref)
                 _conn.ref();
         } catch (SQLException se) {
             throw SQLExceptions.getStore(se, _dict);
         } finally {

It seems like we'd only need to set the truncation property the first time we obtain a connection,
not every time the store uses it. 

> Sybase by default silently truncates a string which is longer than the column length
without raising an exception 
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-745
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-745
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.2.0
>            Reporter: Fay Wang
>            Priority: Minor
>             Fix For: 1.2.1, 1.3.0
>
>         Attachments: OPENJPA-745-1.patch, OPENJPA-745.patch
>
>
> By default, Sybase silently truncates a string which is longer than the column length
without raising an exception. To override this behavior, string_rtruncation must be set on.
In order to be consistent with other databases (which raise exceptions when a string length
is longer than the column length), we will set string_rtruncation on by default for Sybase.
For an application that wants to keep Sybase silent truncation behavior, a DBDictionary property
"setStringRightTruncationOn" is introduced. When it is set to false in the persistence.xml,
the string will be silently truncated during insert/update. 

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


Mime
View raw message