hql中使用left join说明

inner join(内连接)

left outer join(左外连接)

right outer join(右外连接)

full join (全连接,并不常用)

HQL中的条件用with即:left join ... with...?

SQL中的条件用on即:left join ... on...?

语句inner join, left outer join 以及 right outer join
可以简写。

from Cat 
as 
cat    
join cat.mate 
as 
mate    left
join cat.kittens 
as 
kitten

通过HQL的with关键字,你可以提供额外的join条件。

from Cat 
as 
cat    
left join cat.kittens 
as 
kitten        
with kitten.bodyWeight > 10.0


还有,一个"fetch"连接允许仅仅使用一个选择语句就将相关联的对象或一组值的集合随着他们的父对象的初始化而被初始化,这种方法在使用到集合的情况下尤其有用,对于关联和集合来说,它有效的代替了映射文件中的外联接
与延迟声明(lazy declarations).




 from
Cat 
as 
cat    
inner join fetch
cat.mate    left
join fetch cat.kittens


一个fetch连接通常不需要被指定别名, 因为相关联的对象不应当被用在 where 子句 (或其它任何子句)中。同时,相关联的对象
并不在查询的结果中直接返回,但可以通过他们的父对象来访问到他们。


 from
Cat 
as 
cat    
inner join fetch
cat.mate    left
join fetch cat.kittens
child    left
join fetch child.kittens


假若使用iterate()来调用查询,请注意fetch构造是不能使用的(scroll()
可以使用)。fetch也不应该与setMaxResults()
或setFirstResult()共用,这是因为这些操作是基于结果集的,而在预先抓取集合类时可能包含重复的数据,也就是说无法预先知道精确的行数。fetch还不能与独立的
with条件一起使用。通过在一次查询中fetch多个集合,可以制造出笛卡尔积,因此请多加注意。对bag映射来说,同时join
fetch多个集合角色可能在某些情况下给出并非预期的结果,也请小心。最后注意,使用full join fetch 与 right
join fetch是没有意义的。


如果你使用属性级别的延迟获取(lazy fetching)(这是通过重新编写字节码实现的),可以使用 fetch all
properties 来强制Hibernate立即取得那些原本需要延迟加载的属性(在第一个查询中)。


from Document fetch all properties order by name



from Document doc fetch all properties where lower(doc.name)
like ''%cats%''
已标记关键词 清除标记
代码: ``` public Book findByBookNo(String bookNo) { // TODO Auto-generated method stub Session session = HibernateSessionFactory.getSession(); String hql="from Book as book where book.bookNo=:bookNo"; Query query =session.createSQLQuery(hql); //进行到这步就开始出错了 query.setString("bookNo", bookNo); List<Book> books = query.list(); HibernateSessionFactory.closeSession(); if(books.size()>0){ return books.get(0); } else{ return null; } } ``` 出现空指针异常异常如下: ``` java.lang.NullPointerException com.Dao.BookDAOImpl.findByBookNo(BookDAOImpl.java:29) com.Service.BookServiceImpl.inputBook(BookServiceImpl.java:14) com.Action.BookInputAction.execute(BookInputAction.java:37) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.56 logs. ```
这个是登陆源码 ``` public boolean loginObject(User user) throws HibernateException{ System.out.println("6666666666666"); //String hql=("from User u where u.username=? and u.password=?",user.getUsername(),user.getPassword()); //System.out.println("from User u where u.username=? and u.password=?",user.getUsername(),user.getPassword()); List<User> userlist=getHibernateTemplate().find("from User u where u.username=? and u.password=?",user.getUsername(),user.getPassword()); if(userlist.size()>0) return true; else return false; } ``` 这个是报的错 ``` org.hibernate.hql.ast.QuerySyntaxException: unexpected token: where u near line 1, column 32 [from com.ynwi.ssh.beans.User u where u.username=? and u.password=?] org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54) org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47) org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82) org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:286) org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:184) org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:138) org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101) org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80) org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124) org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156) org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135) org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770) org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:914) org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:912) org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:912) com.ynwi.ssh.daoImpl.UserDao.loginObject(UserDao.java:26) com.ynwi.ssh.serviceImpl.UserManagerImpl.login(UserManagerImpl.java:30) com.ynwi.ssh.action.LoginAction.execute(LoginAction.java:24) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:270) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:498) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) ```
一个登陆操作 业务逻辑 这样写查询不出数据 [code="java"]String hql = "from Account user where user.employeeName = '"+object.getEmployeeName()+"'"; [/code] 用 from Account 测试了下 可以查询出数据 问题就是处在这个hql 语句上, 可是这种写法我一直都在用, 没有出现过问题 , 哪位高人能指点下啊. [b]问题补充:[/b] 回一楼的 符合条件的数据确实是存在的 我使用sql语句可以查询出来在MyEclipse Database Explorer 例 如 select * from Account where EmployeeName = '刘总' 是确实能够查询出数据的. [b]问题补充:[/b] 回2楼的 user 我也换过了 不行 [b]问题补充:[/b] 回3楼的 我开始的时候说了 使用from Account 测试了 在System.out.println(list.size()); 的作用下, console 输入了 53 而使用String hql = "from Account user where user.employeeName = '"+object.getEmployeeName()+"'"; 什么结果是 0 [b]问题补充:[/b] 我在业务逻辑层的方法这样写 [code="java"]public boolean isLoginSuccess(Account object) { // TODO Auto-generated method stub String hql = "from Account "; System.out.println("看看业务逻辑层的hql"+hql); List list = commonDAO.search(hql); System.out.println("业务逻辑层这边的城市"+list.size()); if(list.size() > 0){ Account item = (Account)list.get(0); if(object.getEmployeePwd().equals(item.getEmployeePwd())){ return true ; } } return false ; }[/code] 在DAO层方法是这样的 [code="java"]public List search(String hql) { // TODO Auto-generated method stub System.out.println("看看dao层的"+hql); List temp = super.getHibernateTemplate().find(hql); for(int i = 0 ; i < temp.size(); i++){ Account user = (Account)temp.get(i); System.out.println(user.getEmployeeName()); } System.out.println("看看dao层的"+temp.size()); return temp ; }[/code] 想用全部查询来测试是否能够成功查询出Account 表的 数据 , 结果是可以的 业务逻辑方法改回这样 String hql = "from Account account where account.employeeName = '"+object.getEmployeeName()+"'"; 就不行了 console 没输出数据 , list.size() 的输出结果是 0 我在ms sqlserver 的查询分析其使用 select * from Account where EmployeeName = '刘总' 就查询出数据 自己也在dao层的方法使用System.out.println(); 输出方法使用 hql 语句, 都是很正常的, 会不会是hql 到了 ms sqlserver 它的文条件 '刘总' 被转义成了乱码 而不会从数据库获取数据呢? [b]问题补充:[/b] 利用log4j。properties 文件 和 在 applicationContext.xml设置了 <pro key="hibernate.show_sql">true</pro> 在 console 输出了 被转义后的sql语句 [code="sql"]select account0_.EmployeeID as EmployeeID, account0_.EmployeeName as Employee2_0_, account0_.EmployeePwd as Employee3_0_, account0_.EmployeeRight as Employee4_0_, account0_.Remark as Remark0_ from xindunoadb.dbo.Account account0_ where account0_.EmployeeName='??×?'[/code] 很明显被转义后的查询条件成了乱码 这是怎么造成的呢? 我在web.xml是这样写的 [code="xml"]<filter> <filter-name>encodingFilter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>[/code] 怎么还会出现乱码呢? [b]问题补充:[/b] 清哪位帮忙看看 这个filter 的配置哪有问题 我以前是自己写filter 的 用了ssh 之后 才改用 提供了的这个 我另一个demo 也是使用spring 提供的类来做的, 是成功的了 没有道理这个不行啊 [b]问题补充:[/b] 在项目的lib 添加了jtds 1.2.jar 也修改applicationcontext.xml的datasource 配置 , 结果重启tomcat 访问项目就报错了, 说无法创建FormBean了 不得以改回去了 [b]问题补充:[/b] [quote]CharacterEncodingFilter定义的和jsp页面的编码不一致吧 zkl_1987 (初级程序员) 2009-04-09 采纳为答案[/quote] 这个问题比较低级了 , 我也回头查了下 , 没有不统一的问题, 都是UTF-8 [b]问题补充:[/b] [quote]囧rz 结果是编码问题 - -~ 我怎么觉得是你的数据库编码有问题捏? 把建表sql发上来看看。 问题应该就是在数据库的编码上了。 iampurse (级程序员) 2009-04-09[/quote] 这个数据库不是我设计的 是已走的"前辈"留下的 没有建库脚本就没有办法了么? [b]问题补充:[/b] [quote]突然想起来的,不知道你配置没有……我觉得你应该配置了,但是除此之外想不出其它原因: Xml代码 <prop key="connection.characterEncoding">utf8</prop> <prop key="connection.characterEncoding">utf8</prop> hibernate的connection.characterEncoding属性。 Snow_Young (级程序员) 2009-04-09[/quote] 这个我没有写... 请问这个配置是写在SessionFactory 或者 dateSource 的哪个部分? [b]问题补充:[/b] [quote]突然想起来的,不知道你配置没有……我觉得你应该配置了,但是除此之外想不出其它原因: Xml代码 <prop key="connection.characterEncoding">utf8</prop> hibernate的connection.characterEncoding属性。 Snow_Young (级程序员) [/quote] 我配置 [code="xml"] <prop key="connection.characterEncoding">utf8</prop> <prop key="connection.useUnicode">true</prop> [/code] 没有变化..... 复制一下我使用log4j.properties 在consosle 输出的结果 : [code="java"]08:56:02,046 DEBUG QueryTranslatorImpl:177 - HQL: from com.newshieldoa.common.pojo.Account account where account.employeeName = '刘总' and account.employeePwd = '.' 08:56:02,046 DEBUG QueryTranslatorImpl:178 - SQL: select account0_.EmployeeID as EmployeeID, account0_.EmployeeName as Employee2_0_, account0_.EmployeePwd as Employee3_0_, account0_.EmployeeRight as Employee4_0_, account0_.Remark as Remark0_ from xindunoadb.dbo.Account account0_ where account0_.EmployeeName='??×?' and account0_.EmployeePwd='.'[/code] [b]问题补充:[/b] [quote] Java代码 String hql = "from Account user where user.employeeName = :employeeName"; Query query = session.createQuery(hql) .setString("employeeName", object.getEmployeeName()); String hql = "from Account user where user.employeeName = :employeeName"; Query query = session.createQuery(hql) .setString("employeeName", object.getEmployeeName()); 另外你分数也给的太抠门了吧…… Snow_Young (级程序员)[/quote] 呵呵 不是我抠门 我早就没有分了, 发帖之前就是 0 个金币, 我要是有200个 金币 早就全拿出来了 .... 您这个方法 我还没试 毕竟我习惯是在业务逻辑层把hql组织好传递进DAO层的, 您这个方法全是在DAO层做的 [b]问题补充:[/b] [quote]拼的和 命名的都一样的效果吧 - -~ 我还是觉得是你的数据库的问题。 数据库别人留下的 你也可以改的啊 alert 一下就好了嘛 iampurse (级程序员) 2009-04-10[/quote] 我刚刚吧原来2000 的数据库 转移到了 2005 , 很遗憾 还是不行, 跟数据库没有关系了... [b]问题补充:[/b] 我的上帝啊 终于不是乱码了 !!!!!!!!!!!!!!11 在 applicationContext.xml sessionFactory 的配置信息 配置了这样一段代码就搞定了 [code="xml"] <prop key="hibernate.query.factory_class"> org.hibernate.hql.classic.ClassicQueryTranslatorFactory </prop>[/code] 快2天了 终于把这该死的问题搞定了. 做个标记 ,为自己, 为别人.
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页