-->
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.  [ 1 post ] 
Author Message
 Post subject: Sql Server 2005 image type problem
PostPosted: Tue Oct 06, 2009 2:49 pm 
Newbie

Joined: Mon Dec 12, 2005 12:38 pm
Posts: 3
I have a legacy sql server 2005 database, and I need to do a select in a table with a field type image.

I'm using JPA and when I try to do a select(sql) to get this image type field value throws this exception:
Code:
javax.persistence.PersistenceException: org.hibernate.MappingException: No Dialect mapping for JDBC type: -4
        at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
        at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:128)
        at sms.smsat.delegate.ApontamentoDelegate.buscarPorNumero(ApontamentoDelegate.java:102)
        at sms.smsat.delegate.ApontamentoDelegateTest.testBuscarPorNumero(ApontamentoDelegateTest.java:25)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
        at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
        at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
        at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
        at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
        at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:36)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:515)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1031)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:888)
Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: -4
        at org.hibernate.dialect.TypeNames.get(TypeNames.java:79)
        at org.hibernate.dialect.TypeNames.get(TypeNames.java:104)
        at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:393)
        at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:582)
        at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:508)
        at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:524)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1817)
        at org.hibernate.loader.Loader.doQuery(Loader.java:697)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
        at org.hibernate.loader.Loader.doList(Loader.java:2228)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
        at org.hibernate.loader.Loader.list(Loader.java:2120)
        at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
        at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722)
        at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
        at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
        at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:88)
        ... 22 more


I had success using sql to insert bytes in this field with jpa.

Thanks.

_________________
Claudio Escobar Apparicio


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

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.