0

我有这些 POJO 课程

public class MapProxy implements Serializable {

    private Service service;
    private Application application;
    private Connector connector;

    //getter and setter
}

public class CategoryTranslator implements Serializable{

    private ArtCategory artCat;
    private ProviderCategory providerCat;
    private String provider;

    //gettere and setter
}

我在 ArtCategory xml 映射器中编写了一个查询,结果是来自 serviceName 和 applicationName 的 ArtCategory

这里是查询

<query name="ArtCategory.getCategoryByServApp">
    SELECT DISTINCT cat_t.artCat
    FROM CategoryTranslator cat_t 
    INNER JOIN MapProxy mp WITH (cat_t.provider = mp.connector.provider.name)
    INNER JOIN mp.service ser WITH (ser.serviceName=:serviceName)
    INNER JOIN mp.application app WITH (app.applicationName=:applicationName)
</query>

当我执行此查询时,我收到一个 Hibernate 异常:

11:52:55,485 ERROR [PARSER]  Invalid path: 'mp.application'
11:52:55,499 ERROR [SessionFactoryImpl] Error in named query: ArtCategory.getCategoryByServApp
org.hibernate.hql.ast.QuerySyntaxException: Path expected for join!

[更新]

此查询运行良好:

SELECT DISTINCT cat_t.artCat
FROM CategoryTranslator cat_t 
WHERE cat_t.provider='test'

在另一个 xml 映射器(MaxProxy)中,我也有这个运行良好的查询

<query name="MapProxy.getProxy_service_app">
    SELECT mp
    FROM MapProxy mp
    INNER JOIN mp.service srv WITH (srv.serviceName=:serviceName) 
    INNER JOIN mp.application app WITH (app.applicationName=:applicationName)   
</query>

为什么hiberante不能映射mp.application?我错了什么?

4

0 回答 0