Issue Details (XML | Word | Printable)

Key: HHH-3161
Type: Bug Bug
Status: Open Open
Priority: Critical Critical
Assignee: Unassigned
Reporter: cyrus
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Hibernate Core

No Dialect mapping for JDBC type: -4

Created: 04/Mar/08 06:18 PM   Updated: 10/May/09 10:57 PM
Component/s: core, query-hql, query-sql
Affects Version/s: 3.2.1
Fix Version/s: None

Time Tracking:
Not Specified

Environment: hibernate 3.2.1 + mysql
Issue Links:
Fix
 


 Description  « Hide
When I execute the statement below:

SELECT concat(case ip_protocol when 6 then 'TCP' when 17 then 'UDP' else 'OTHER' end, ', PORT ', repeat(' ', 5 - length(if(port is NULL, 0, port))), if(port is NULL, 0, port)) as protocol, concat(case ip_protocol when 6 then 'TCP' when 17 then 'UDP' else 'OTHER' end, if(port is NULL, 0, port)) as id, sum(byte_subtotal) as total FROM usage_sum_minute WHERE from_unixtime(time_min * 60) between '2008-02-03 14:00:00' and '2008-03-05 13:59:00' GROUP BY protocol ORDER BY total DESC LIMIT 0, 20

DB schema:
CREATE TABLE `ascot`.`usage_sum_minute` (
  `id` int(11) NOT NULL auto_increment,
  `igateway_id` smallint(5) NOT NULL,
  `time_min` int(11) NOT NULL,
  `user_name` varchar(255) default NULL,
  `mac_local` varchar(80) NOT NULL,
  `ip_local` bigint(20) NOT NULL,
  `ip_remote` bigint(20) NOT NULL,
  `ip_protocol` smallint(5) NOT NULL,
  `port` smallint(6) default NULL,
  `domain_name` char(80) default NULL,
  `url` varchar(1024) default NULL,
  `byte_subtotal` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`),
  KEY `index_igateway` (`igateway_id`),
  KEY `index_protocol` (`ip_protocol`),
  KEY `index_minute` (`time_min`),
  KEY `index_user` (`user_name`),
  KEY `index_port` (`port`),
  KEY `index_ip` (`ip_remote`)
) ENGINE=InnoDB AUTO_INCREMENT=505699 DEFAULT CHARSET=latin1

It give an exception "No Dialect mapping for JDBC type: -4"

 All   Comments   Work Log   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Alexey Stukalov added a comment - 01/Apr/08 01:36 PM
Had the same problem. Using mysql-connector 5.1.6.
Seems the suspected type is 'blob': com.mysql.jdbc.MysqlDefs.mysqlToJavaType("blob") gives -4.

Alexey Stukalov added a comment - 01/Apr/08 02:05 PM
Actually, Types.LONGVARBINARY = -4 is defined in java.sql

Tajinder Singh added a comment - 22/Aug/08 01:28 AM
I have a similar issue with Hibernate3 + mysql-connector 5.1.6 .

my hibernate mapping is like : -

<property name="testObject" >
   <column name="object" sql-type="java.sql.BLOB"/>
</property>

I could save blob (save the object) using same mapping. But when I try to load it from the DB table, it gives me following exception :-

org.hibernate.MappingException: No Dialect mapping for JDBC type: -4.


Please note that, I could save and retrieve the blob when I use resultset object instead of Hibernate.

The current workaround I am using is, saving a blob using hibernate, and retrieving it using resultSet object.






Gail Badner added a comment - 10/May/09 10:56 PM
This should be fixed by HHH-3892. The fix is already checked into trunk and will be ported to the other branches shortly.

Could someone please try checking out trunk (http://anonsvn.jboss.org/repos/hibernate/core/trunk/) and let me know if it solves this problem?

The new Hibernate type, "image", will be mapped to either "medium blob" or "long blob" column type, depending on the length defined.

Thanks,
Gail