1. 程式人生 > >hibernate:Path expected for join問題

hibernate:Path expected for join問題

Os類 
public class Os { 
    private Long id; 
    private Set<OsFeature> osFeatures = new HashSet<OsFeature>(); 
    @Id 
    @GeneratedValue(strategy = GenerationType.AUTO) 
    @Column(name="OsId", unique = true, nullable = false, insertable = true, 
     updatable = true) 
    public Long getOsId() { 
return osId; 
     } 
      @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "os") 
    public Set<OsFeature> getOsFeatures() { 
return osFeatures; 
    } 
} 


OsFeature類: 
public class OsFeature{ 
   
   private Long id; 
    private Os os;
@Id 
@GeneratedValue(strategy = GenerationType.AUTO) 
@Column(name = "OsFeatureId", unique = true, nullable = false,  insertable = true, updatable = true) 
public Long getId() { 
    return id; 
} 
@ManyToOne(fetch = FetchType.LAZY) 
@JoinColumn(name = "OsId", referencedColumnName = "OsId", unique = false, nullable = false, insertable = true, updatable = true) 
public Os getOs() { 
    return os; 
} 
} 

分析: 
    Os與 OsFeature之間的關聯為:OneToMany(一對多); 

需求: 
    查詢Os,需要OsFeature中的某個屬性作為查詢條件; 

HQL語句: 
    select model from Os model join model.osFeatures osf where osf.featureString 
    like %xxxx% 

語句分析:join後面所跟的是 model.osFeatures,osFeatures為Os中的屬性,而並不是OsFeature物件 

如果join後面跟的是OsFeature物件,將會報Path expected for join異常! 

相關推薦

hibernate:Path expected for join問題

Os類 public class Os { private Long id; private Set<OsFeature> osFeatures = new HashSet<OsFeature>(); @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

Path expected for join!錯誤處理

在Hibernate中,進行連線查詢時,如果使用join語句,就容易產生標題所示的錯誤。 比如from Content o left join Mcp mcp where o.mcp.id=mcp.id and mcp.id=2 正確的做法應該是在A中建立private M

HQL語句 Path expected for join!錯誤

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

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

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

requirejs r.js 打包報錯paths fallback not supported in optimizer please provide a build config path override for jquery

vid log 技術 optimizer ges mage all config support 錯誤原因: 改為: requirejs r.js 打包報錯paths fallback not supported in optimizer please provide

jpa/hibernate @onetomany 使用left join 添加多條件,可以使用過濾器filters (with-clause not allowed on fetched associations; use filters異常信息)

modified tran SQ fetch join vat reac sset nag package com.ipinyou.mip.dataAsset.campaignManagement.entity; import com.ipinyou.mip.util

項目筆記《DeepLung:Deep 3D Dual Path Nets for Automated Pulmonary Nodule Detection and Classification》(三)(下)結果評估

correct 都是 ota 定義 tran average lua same -- 在(上)中講了如何得到csv文件並調用noduleCADEvaluationLUNA16.py求取froc值,這裏就講一講froc值是如何求取的。    annotations_file

【轉】Accessing Intel Omni-Path publications for Red Hat Enterprise Linux

原文連結:https://access.redhat.com/articles/2039623   Accessing Intel Omni-Path publications for Red Hat Enterprise Linux Updated November

Growth Expected for Personalized and Adaptive Learning

Personalized and adaptive learning both have the power to reach learners in new ways. Whether organizations are developing personalized learning (tailored

Error:Cannot start process, the path specified for working directory is not a directory

If I open one file such as "hw3_prob4Sol.py", the code can run. However, there is an error: Cannot start process, the path specified for working direc

Open quote is expected for attribute "property" associated with an element type "result".

tomcat伺服器啟動的時候報的錯誤  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'faqFormService' defined in f

org.hibernate.QueryException: Unmatched braces for alias path問題記錄(目前不知道什麼問題導致)

1、錯誤 org.hibernate.QueryException: Unmatched braces for alias path [INSERT INTO TENDER_OPENING_TAB (BID_OPENING_TIME,BID_OPENING_ADDRESS

解決Visual C++ for Linux: -L"~/projects/path_to_lib_folder" 無法設置library search path的問題

一個 是個 映射 images 目的 ++ 用戶名 visual 技術 最近倒騰Linux C/C++項目。以目前的情況來說,要生成編譯(build)一個Linux工程腳本,首選的工具必定是CMake。這也是我之前Linux項目的首選。不過自從VS IDE支持Linux C

Hibernate入門第二課 Hibernate Tools for Eclipse Plugins安裝

tails center 問題 名稱 lips 心得 ane 軟件 ins Hibernate入門第二課 Hibernate Tools for Eclipse Plugins安裝 你們可以直接去,http://blog.csdn.net/wei_chong_chong/a

for xml path

cnblogs png path .cn http .com ima img -s 在SQL Server中利用 FOR XML PATH 語句能夠把查詢的數據生成XML數據 示例:

T-sql for xml path使用(轉)

man represent con code .com rom manage agen 指定 參考: http://www.cnblogs.com/langhua/p/4193161.html //用法: FOR XML PATH 方法是用於將查詢結果集以XML形式展示 s

靈活運用 SQL SERVER FOR XML PATH

eight str 類型 spa ima 更多 for 逗號 image FOR XML PATH 有的人可能知道有的人可能不知道,其實它就是將查詢結果集以XML形式展現,有了它我們可以簡化我們的查詢語句實現一些以前可能需要借助函數活存儲過程來完成的工作。那麽以一個實例為

SQLServer中sql for xml path 的用法

left 關註 所有 -- htm tar 測試數據 str lan 閱讀目錄 創建測試表&插入測試數據 for xml path使用 普通用法 自定義節點名稱 將字段作為xml的屬性 我們通常需要獲取一個多行的某個字段拼出的字符串

01-Hibernate Tools for Eclipse Plugins安裝

lan nload gin enter war 低版本 -h 鼠標 hiberna Hibernate Tools for Eclipse Plugins安裝 在線安裝有兩種方法 方法一:"Help > Install New Software Updates" 可