使用了hibernate的项目发布时tomcat转weblogic 11出现"标示符无效"的问题
2011-12-01 09:16
615 查看
前天把项目从tomcat转至weblogic11的时候发现了这么一个问题,
工作台提示"标示符无效",网上查了都没有什么类似的情况,
细一看,数据库里的字段加了下划线,实体类里的属性却没有加,起初认为是HQL写得不规范没有用参数化,也就是用问号来作预编译,
故而昨天改了一天,把HQL全部改成了问号模式而不是拼接字符串的方式,但是问题依旧存在,
估计是hibernate和weblogic11有些地方太过严谨或者是不兼容。
最后得出两种处理方法,第一种是纯用sql,不管是拼接字符串还是用问号预编译,都能成功
第二种是再hibernate属性中加上这么一段话:
然后再把所有的HQL加上别名,例如:
工作台提示"标示符无效",网上查了都没有什么类似的情况,
细一看,数据库里的字段加了下划线,实体类里的属性却没有加,起初认为是HQL写得不规范没有用参数化,也就是用问号来作预编译,
故而昨天改了一天,把HQL全部改成了问号模式而不是拼接字符串的方式,但是问题依旧存在,
估计是hibernate和weblogic11有些地方太过严谨或者是不兼容。
最后得出两种处理方法,第一种是纯用sql,不管是拼接字符串还是用问号预编译,都能成功
第二种是再hibernate属性中加上这么一段话:
<prop key="hibernate.query.factory_class"> org.hibernate.hql.classic.ClassicQueryTranslatorFactory </prop>
然后再把所有的HQL加上别名,例如:
from movie m,movieinfo mi where m.movieid=mi.movieid
相关文章推荐
- hibernate查询的时候出现“列名 "&&"无效”的问题
- 使用eclipse发布web服务出现"Error occured when adding the module, xxxxxx, to the server"
- Android 在Eclipse中使用Ant Build构建项目时出现的"crunch"
- 使用dsoframer控件出现"Unable to display the inactive document. Click here to reactivate the document."的问题
- 使用XCode6打开项目以后再用XCode5出现的问题fatal error: malformed or corrupted AST file: 'Unable to load module
- 使用<input type="text" value=<%=str%>>出现取值不全的问题
- 整合spring4和hibernate4出现问题———"hibernate.dialect” not set
- 写了一个查询数据库的程序,不熟的Tomcat6。查询条件为英文时运行正常,为中文时出现乱码。后在tomcap的server.xml中加入useBodyEncodingForURI="true解决了问题
- tomcat的复制项目时出现 Multiple Contexts have a path of "/EasyUI01". && easyui的data-options中不能出现分号,显示错误
- 运行ASP.NET出现的问题:无法直接启动带有"类型输出类型"的项目
- 使用dsoframer控件出现"Unable to display the inactive document. Click here to reactivate the document."的问题
- 关于使用Tomcat搭建的Web项目,出现 URL 中文乱码的问题解析
- myeclipse中用tomcat服务器发布程序问题An internal error occurred during: "Launching 项目名 on Tomcat 6.x". java.la
- 关于在Java中使用request.getRequestDispatcher(".....")引起的css文件无效或图片无效问题。
- eclipse运行android项目出现"The connection to adb is down, and a severe error has occured."的问题
- 使用XCode6打开项目以后再用XCode5出现的问题fatal error: malformed or corrupted AST file: 'Unable to load module
- vs上出现"未能加载项目文件,根级别上的数据无效.Microsoft.WinFx.targets"的解决方法
- 使用appcompat这个包之后出现Attribute "height" has already been defined这个问题。
- Maven管理的web项目,在使用tomcat发布的时候出现java.lang.NoClassDefFoundError
- 使用XCode6打开项目以后再用XCode5出现的问题fatal error: malformed or corrupted AST file: 'Unable to load module