Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Short

You could also use a TypeConverter from Boolean to Integer using @Convert. 
Not all databases support boolean.



tware wrote:
> 
> Our DDL Generation uses SMALLINT DEFAULT 0.  That worked up until the most 
> recent version.  I believe this bug should be initially persued with Derby 
> because this is a regression on their part.
> 
> Michael Norman wrote:
>> According to the Derby docs, the proper DDL artifact for 
>> java.lang.Boolean is "CHAR(1) FOR BIT DATA".
>> 
>> Tom - do we handle that in our DDL generation?
>> ---
>> Mike Norman
>> 
>> On 22/09/2011 10:23 AM, Tom Ware wrote:
>>> Hi Warren,
>>>
>>>   I think this is a Derby bug.  I ran this code (JDBC only):
>>>
>>>           String statementString = "INSERT INTO BOOK (ID, 
>>> ILLUSTRATIONS) VALUES (?, ?)";
>>>           PreparedStatement statement = 
>>> connection.prepareStatement(statementString);
>>>           statement.setInt(1, 1);
>>>           statement.setBoolean(2, false);
>>>           statement.executeUpdate();
>>>
>>> And I get the same error.
>>>
>>> -Tom
>>>
>>>
>>> Warren Tang wrote:
>>>> Both the server and the embedded mode throw the same error. Seems to 
>>>> be a regression.
>>>>
>>>> Regards,
>>>> Warren Tang <http://blog.tangcs.com>
>>>>
>>>>
>>>> On Thursday, September 22, 2011 3:07:22 AM, Tom Ware wrote:
>>>>> Are you running the embedded version of derby or the client-server 
>>>>> version?  If
>>>>> you're running the client-server version, are you sure the jdbc jar 
>>>>> and the
>>>>> server version are a match?
>>>>>
>>>>> -Tom
>>>>>
>>>>> Warren Tang wrote:
>>>>>>   Finally found the cause. It's related to the version of Derby. 
>>>>>> Once I change the version from the latest 10.8.1.2 back to 
>>>>>> 10.4.2.0, the error goes away.
>>>>>>
>>>>>> Regards,
>>>>>> Warren Tang <http://blog.tangcs.com>
>>>>>>
>>>>>>
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
Performance 
-- 
View this message in context: http://old.nabble.com/java.lang.ClassCastException%3A-java.lang.Boolean-cannot-be-cast-to-java.lang.Short-tp32512608p32549606.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top