-->
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.  [ 3 posts ] 
Author Message
 Post subject: SAPDBDialect and "No Dialect mapping for JDBC type: 3 e
PostPosted: Fri Jun 02, 2006 6:55 am 
Newbie

Joined: Wed Mar 29, 2006 10:48 am
Posts: 5
Location: Russia
Hi All,

I'm using hibernate 3.1 with MaxDB 7.5.00.

When I try to execute query "select count(*) from the_table" using createSQLQuery, I get an exception: "No Dialect mapping for JDBC type: 3".

I've googled for the SAPDBDialect source. The constructor there looks like this:
Code:
   public SAPDBDialect() {
      super();
      registerColumnType( Types.BIT, "boolean" );
      registerColumnType( Types.BIGINT, "fixed(19,0)" );
      registerColumnType( Types.SMALLINT, "smallint" );
      registerColumnType( Types.TINYINT, "fixed(3,0)" );
      registerColumnType( Types.INTEGER, "int" );
      registerColumnType( Types.CHAR, "char(1)" );
      registerColumnType( Types.VARCHAR, "varchar($l)" );
      registerColumnType( Types.FLOAT, "float" );
      registerColumnType( Types.DOUBLE, "double precision" );
      registerColumnType( Types.DATE, "date" );
      registerColumnType( Types.TIME, "time" );
      registerColumnType( Types.TIMESTAMP, "timestamp" );
      registerColumnType( Types.VARBINARY, "long byte" );
      registerColumnType( Types.NUMERIC, "fixed(19,$l)" );
      registerColumnType( Types.CLOB, "long varchar" );
      registerColumnType( Types.BLOB, "long byte" );

      getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE);

   }

There really is not defined a mapping for type 3, which is Types.DECIMAL. So, I defined my own dialect:
Code:
public class CustomSAPDBDialect extends SAPDBDialect {

   public CustomSAPDBDialect() {
      super();
      registerColumnType(Types.DECIMAL, "int");
   }
   
}

EAR deploying log excerpt:
Code:
14:33:26,067 INFO  [SettingsFactory] RDBMS: SAP DB, version: Kernel    7.5.0    Build 024-000-000-000
14:33:26,067 INFO  [SettingsFactory] JDBC driver: SAP DB, version: package com.sap.dbtech.jdbc, MaxDB JDBC Driver, MySQL MaxDB, 7.6.0    Build 016-000-004-753
14:33:26,078 INFO  [Dialect] Using dialect: com.smartphonelabs.portal.util.CustomSAPDBDialect


However, I still get the No Dialect Mapping exception. :| Can someone help me to resolve the issue?

Thanks, Jlexa


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 02, 2006 7:02 am 
Regular
Regular

Joined: Mon May 08, 2006 6:00 am
Posts: 53
Location: India
Try following and see if it works for you.


public class CustomSAPDBDialect extends SAPDBDialect {

public CustomSAPDBDialect() {
super();

registerColumnType( Types.DECIMAL,"number($p,$s)" );

registerHibernateType(Types.DECIMAL,
"big_decimal");
}
}


Sudhir

Dont forget to rate :-)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 02, 2006 7:24 am 
Newbie

Joined: Wed Mar 29, 2006 10:48 am
Posts: 5
Location: Russia
Yes, this works for me. Thanks a lot! =)

Still no idea, why and what was the matter and why wasn't this included in the SAPDBDialect.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.