-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate / Firebird bug?
PostPosted: Thu Sep 07, 2006 3:54 pm 
Newbie

Joined: Thu Sep 07, 2006 3:20 pm
Posts: 2
Hibernate version: 3.1.3 and 3.2.0.cr4

Name and version of the database you are using: Firebird 1.5.3, JayBird 2.0.1 and 2.1.0 (embedded).

Driver class:: org.firebirdsql.jdbc.FBDriver

Hi,

The problem: like queries throw DataTruncation exceptions or produce empty results when the search text reachs the column length or the column length -1.

What I try to do is:

Code:
Restrictions.like("fieldName", "%" + filter + "%")

or:

Code:
Restrictions.like("fieldName", filter, MatchMode.ANYWHERE)


Over a VARCHAR field. The generated result is as simple as:

Code:
... where fieldName like ?


A) With JayBird 2.0.1 and Hibernate (3.1.3 or 3.2.0-rc4)

I get a DataTruncation exception:

Code:
Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
        at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.loader.Loader.doList(Loader.java:2148)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
        at org.hibernate.loader.Loader.list(Loader.java:2024)
        at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1533)
        at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
...
Caused by: java.sql.DataTruncation: Data truncation
        at org.firebirdsql.jdbc.field.FBWorkaroundStringField.setString(FBWorkaroundStringField.java:95)
        at org.firebirdsql.jdbc.AbstractPreparedStatement.setString(AbstractPreparedStatement.java:383)
        at org.hibernate.type.StringType.set(StringType.java:26)
        at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:83)
        at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:65)
        at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1514)
        at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1576)
        at org.hibernate.loader.Loader.doQuery(Loader.java:661)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
        at org.hibernate.loader.Loader.doList(Loader.java:2145)
        ... 16 more


B) With JayBird 2.1.0 and Hibernate (3.1.3 or 3.2.0-rc4)

No exception is thrown, but the query produces an empty result when there should be matches.

Am I doing something wrong or stupid? Should I file a bug report for it?

Regards.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 3:00 am 
Newbie

Joined: Thu Sep 07, 2006 3:20 pm
Posts: 2
Just for the record, it seems it's a bug: http://tracker.firebirdsql.org/browse/JDBC-90


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.