1. 程式人生 > >每日一得-org.hibernate.hql.ast.QuerySyntaxException: Path expected for join!錯誤解決辦法

每日一得-org.hibernate.hql.ast.QuerySyntaxException: Path expected for join!錯誤解決辦法

org.hibernate.hql.ast.QuerySyntaxException: Path expected for join!

HQL進行JOIN連線查詢時需要注意幾點:

1.HQL不支援ON,需要將ON換成WHERE

2.需要註明物件之間的對映關係

Product.hbm.xml對映檔案如下:

<one-to-one name="book" class="com.entity.Book" fetch="join"/>

Product類中需要有

private Book book;

HQL語句:

String hql = "select new com.entity.BookInfo(p.id,p.productName,p.fixedPrice,p.dangPrice,p.addTime," +
     "b.author,b.publishing,b.publishTime,b.catalogue,p.productPic)"+
         "from Product p, Book b where p.id=b.id and b.publishTime=(" +
         "select max(b.publishTime) from Product p join p.book b where p.id=b.id)";

相關推薦

每日-org.hibernate.hql.ast.QuerySyntaxException: Path expected for join!錯誤解決辦法

org.hibernate.hql.ast.QuerySyntaxException: Path expected for join! HQL進行JOIN連線查詢時需要注意幾點: 1.HQL不支援ON,需要將ON換成WHERE 2.需要註明物件之間的對映關係 Produc

SSH執行hql報錯:Caused by: org.hibernate.hql.ast.QuerySyntaxException: user is not mapped [from user where username = ?]

執行 occurred ble xml文件 ron red 報錯 temp caused 報錯信息: ERROR Dispatcher:38 - Exception occurred during processing request: user is not mapped

org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User] 異常總結

異常如下:org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User]  at org.hibernate.hql.ast.util.SessionFactoryHelper.requi

SSH報錯:org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [select o from User o where 1=1

Struts has detected an unhandled exception:  Messages: 1.User is not mapped [select o from User o where 1=1 order by o.id asc] 2.User is not mapped [select

HQL子查詢報錯:org.hibernate.hql.ast.QuerySyntaxException: unexpected token...

HQL語句: selectcount(*) from (select stu.classId  from Student stu groupby stu.classId) t_tmp_count 執行

HQL語句 Path expected for join!錯誤

HQL語句 select  b from SmallNewsClass s left join s. belongBigNewsClass b 起先我以為s. belongBigNewsClass  中的belongBigNewsClass 對應的是資料庫中的屬性名或者是表

No data type for node: org.hibernate.hql.ast.tree.IdentNode問題的解決

      使用Hibernate的時候,出現這個錯誤資訊,經過網上的解決方法,成功的解決這個錯誤資訊,並且記錄下來。        從錯誤資訊,可以看出是因為在執行hql語句的時候,hql中填寫的欄位沒有和實體類中的欄位對應,但是我檢視自己的實體類中的屬性的名稱和屬性對於

Hibernate HQL的條件中如果in包含太多的引數會導致堆疊溢位StackOverflowError、org.hibernate.hql.ast.util.NodeTraverser.visit

轉自:http://www.bitiliu.com/archives/43 異常情況 java.lang.StackOverflowError at rg.hibernate.hql.ast.QueryTranslatorImpl$JavaConstant

weblogic10異常:org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.

GOOGLE上找到解決方法,記錄與些,本人採用的方法三. 原因: Hibernate3.0 採用新的基於ANTLR的HQL/SQL查詢翻譯器,在Hibernate的配置檔案中,hibernate.query.factory_class屬性用來選擇查詢翻譯器。 (1)選擇Hibernate3.0的查詢翻譯

weblogic 下異常 org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken

    專案之前在 Tomcat 環境下一直都正常執行,今天應客戶要求需要遷移到 webLogic 10.3.6 下, 部署後竟然丟擲了 org.hibernate.QueryException: ClassNotFoundException: org.hibernate.

hibernate:Path expected for join問題

Os類 public class Os { private Long id; private Set<OsFeature> osFeatures = new HashSet<OsFeature>(); @Id

HQL join Path expected for join! 原因及處理

HQL的join不支援沒使用外來鍵連線的不同表查詢 HQL : from BizDomain b left join BizDomainToMeta a org.hibernate.hql.ast.QuerySyntaxException: Path expecte

org.hibernate.hql.internal.ast.QuerySyntaxException: Base is not mapped [from Base]

Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Base is not mapped org.hibernate.hql.internal.ast.QuerySyntaxException: Base is not

org.hibernate.hql.internal.ast.QuerySyntaxException: expecting OPEN, found 'from' near line 1, colum

程式碼如下: package cn.com.query; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; i

org.hibernate.hql.internal.ast.QuerySyntaxException: USER is not mapped 報錯解決

錯誤日誌: org.hibernate.hql.internal.ast.QuerySyntaxException: USER is not mapped [FROM USER] at org.hibernate.hql.internal.ast.QuerySyntaxEx

Hibernate查詢報錯:org.hibernate.hql.internal.ast.QuerySyntaxException: XXX is not mapped

這個錯誤的產生原因是,hibernate執行查詢的語句hql是面向物件的查詢,而不是面向資料庫表的查詢,因此在hql語句中的物件名必須與實體類的類名一致,嚴格區分大小寫。 如實體類為 Car,則hql

mysql開發之---每日01

查看 delete div global rop 清空 rem not use 2015年7月7日------------------------- 1、trunc

Hibernate配置單向一對多或多對,出現 org.hibernate.MappingException: Repeated column in mapping for entity5

報錯情況就是這樣,網上一般情況是說的 使用的Hibernate實體類對映資料庫時 配置對應 對映時出現了重複情況** should be mapped with insert=“false” update=“false”) 主要是因為 資料庫裡面的欄位只能對映到

maven專案中 org.hibernate.MappingNotFoundException: resource:**.hbm.xml not found問題的解決方案

maven中配置hibernate,檔案結構如下: 測試: public static void main(String[] args) { AccountEntity account = new AccountEntity();

【報錯】Caused by: org.hibernate.MappingException: Repeated column in mapping for entity:

報錯資訊: Caused by: org.hibernate.MappingException:         Repeated column in mapping for entity:              com.zking.four.entity.OrderI