-->
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: HSQLDialect and Booleans in native queries
PostPosted: Thu Jan 17, 2008 3:47 am 
Newbie

Joined: Thu Jan 17, 2008 3:42 am
Posts: 6
Hibernate version:
latest GA

I think i have found a bug in HSQL Dialect. When using a *native* query involving a boolean column, i get
*org.hibernate.MappingException: No Dialect mapping for JDBC type: 16*

Example:
Code:
@Entity public class Foo{
@Id int id;
boolean bar;
[..]
}

Code:
SELECT id,bar FROM Foo f


This problem can be worked around by using

Code:
public class CustomHSQLDialect extends org.hibernate.dialect.HSQLDialect
{
    public CustomHSQLDialect()
    {
        registerColumnType(Types.BOOLEAN, "boolean");
        registerHibernateType(Types.BOOLEAN, "boolean");
    }
}


Should i file a bug for that, or is this a well-known limitation?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 21, 2008 3:05 am 
Newbie

Joined: Mon Jun 11, 2007 1:34 pm
Posts: 11
I'm not sure this has relation but...

When i switch from mysql to hsqldb i have to use this dialect:

Code:
public class HSQLDialect_HHH_1598 extends org.hibernate.dialect.HSQLDialect {

    public HSQLDialect_HHH_1598() {
        super();
        registerColumnType(Types.BIT, "boolean");

        // Assert that the new type is registered correctly.
        if (!"boolean".equals(getTypeName(Types.BIT))) {
            throw new IllegalStateException("Failed to register HSQLDialect "
                    + "column type for Types.BIT to \"boolean\".");
        }
    }
}


here is some explanation about this.
http://forum.hibernate.org/viewtopic.php?p=2324183


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.