openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-525) Inserts new entity with NULL value for Clob column actually inserts empty string
Date Mon, 06 Jul 2009 19:33:14 GMT

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

Albert Lee commented on OPENJPA-525:
------------------------------------

After the latest patch, I am seeing the following exception:

Caused by: java.lang.ClassCastException: org.apache.openjpa.jdbc.schema.DynamicSchemaFactory$DynamicColumn
incompatible with java.lang.Number
at org.apache.openjpa.jdbc.sql.ResultSetResult.getCharacterStreamInternal(ResultSetResult.java:305)
at org.apache.openjpa.jdbc.sql.ResultSetResult.getObjectInternal(ResultSetResult.java:423)
at org.apache.openjpa.jdbc.sql.AbstractResult.getObject(AbstractResult.java:694)
at org.apache.openjpa.jdbc.meta.strats.HandlerStrategies.loadDataStore(HandlerStrategies.java:220)
at org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.load(HandlerFieldStrategy.java:186)
at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:912)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1015)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:967)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:391)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:290)
at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.initialize(WsJpaJDBCStoreManager.java:147)
at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1003)
at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:961)

Look further in the changes and found in:

ResultSetResult.java 

    protected Object translate(Object obj, Joins joins)
        throws SQLException {
        if (obj instanceof Number)
            return obj;
        // getStringInternal will take care the translation
        if (obj instanceof Column && ((Column) obj).getType() == Types.CLOB)
        	return obj;
        return Numbers.valueOf(findObject(obj, joins));
    }

The newly added code will always return object which is a Column type. However this method
is expect a Number object to be returned.

        // getStringInternal will take care the translation
        if (obj instanceof Column && ((Column) obj).getType() == Types.CLOB)
        	return obj;

Albert Lee.


> Inserts new entity with NULL value for Clob column actually inserts empty string
> --------------------------------------------------------------------------------
>
>                 Key: OPENJPA-525
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-525
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.0.0, 1.0.2, 1.1.0, 2.0.0
>         Environment: OpenJPA 1.0.0, 1.0.2
> Oracle XE 10g (JDBC driver 10.2.0.3.0
> JRE 1.5.0_13
>            Reporter: Frank Le
>             Fix For: 1.1.1, 2.0.0
>
>         Attachments: OPENJPA525.patch, OPENJPA525_1_1_x.patch
>
>
> Inserts new entity with NULL value for Clob column with "nullable = true" actually inserts
empty string as the value!
> Here's the persistence class:
> public class Exam... {
>     @Lob
>     private String text;
> }

-- 
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