如题 ,我在编写j2ee的过程中碰到了这个问题,查了一些资料,有些人说是在hibernate中没定义过text类型(我的数据库表确实有这个类型的字段)可是我按照它的写法做了。。还是会出问题
以下是错误
org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:192)
at org.hibernate.loader.custom.CustomLoader.getHibernateType(CustomLoader.java:161)
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:131)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1678)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
......................
我的三个表分别是subarea,reside,userinfo
subarea:id,subareaname
reside: id,sid, rname,content,edituserid-------其中content就是text类型的字段
userinfo:id,userinfo--------等字段
其中reside中的sid关联subarea表的id,edituserid关联userinfo的id
在做j2ee的过程中。它会自动生成pojo(所有的pojo以及配置文件都是自动生成的,在更新完数据库后,我把所有的映射,配置都删掉重新弄了,也是用工具自动生成的)
其中reside.java类的内容为
private Integer id;
private Userinfo userinfo
private Subarea subarea;
private String rname;
private String content;
(**************省略get.set方法*****************)
它的查询方法是
public List indexlist(){
session=HibernateSessionFactory.getSession();
try{
sqlquery=session.createSQLQuery("select reside.id,reside.sid,reside.rname,reside.content,reside.edituserid,userinfo.username from reside,userinfo where reside.edituserid=userinfo.id");
List indexlist=sqlquery.list();
return indexlist;
}catch(Exception ex){
ex.printStackTrace();
System.out.println("分区读取出错");
return null;
}finally{
if(session.isOpen()){
session.close();
}
}
}出现这种错误是为什么啊,在之前我没更新数据库之前(即未加放content字段时就不会出现这种错误)
以下是错误
org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:192)
at org.hibernate.loader.custom.CustomLoader.getHibernateType(CustomLoader.java:161)
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:131)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1678)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
......................
我的三个表分别是subarea,reside,userinfo
subarea:id,subareaname
reside: id,sid, rname,content,edituserid-------其中content就是text类型的字段
userinfo:id,userinfo--------等字段
其中reside中的sid关联subarea表的id,edituserid关联userinfo的id
在做j2ee的过程中。它会自动生成pojo(所有的pojo以及配置文件都是自动生成的,在更新完数据库后,我把所有的映射,配置都删掉重新弄了,也是用工具自动生成的)
其中reside.java类的内容为
private Integer id;
private Userinfo userinfo
private Subarea subarea;
private String rname;
private String content;
(**************省略get.set方法*****************)
它的查询方法是
public List indexlist(){
session=HibernateSessionFactory.getSession();
try{
sqlquery=session.createSQLQuery("select reside.id,reside.sid,reside.rname,reside.content,reside.edituserid,userinfo.username from reside,userinfo where reside.edituserid=userinfo.id");
List indexlist=sqlquery.list();
return indexlist;
}catch(Exception ex){
ex.printStackTrace();
System.out.println("分区读取出错");
return null;
}finally{
if(session.isOpen()){
session.close();
}
}
}出现这种错误是为什么啊,在之前我没更新数据库之前(即未加放content字段时就不会出现这种错误)
解决方案 »
- 求助,JFreeChart报表图片中文乱码问题
- 不知道为什么我的js报错说语法不对。。
- JAVA求职(北京)
- 求个ext3.1+,struts2,hibernate,spring的demo
- javax.mail.internet.ParseException: Unbalanced quoted string
- java.代码生成器来了....开启节约编程时间的时代来了.....
- java 调用windos自带的dll实例
- 部署RMI安全策略文件出现异常我应该如何解决?
- 超级菜鸟的问题:关于JDK在98下的安装和测试
- 点击登录,action中的findbyall没反应,控制台也没有报错,执行不了List user =userDAO.findAll();,为什么?求助
- daemon
- 关于tomcat jaas登录问题
严重: Servlet.service() for servlet default threw exception
org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:231)
at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:559)
at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:485)
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:501)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1677)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
at com.union.dao.HibernateGenericDao.pagedQueryBySql(HibernateGenericDao.java:394)
at com.union.service.product.Impl.UnionSiteProductServiceImpl.getUnionSiteProductInfo(UnionSiteProductServiceImpl.java:21)
at com.union.service.product.Impl.UnionSiteProductServiceImpl$$FastClassByCGLIB$$d3a34512.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)