Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Hibernate左联接中的联接错误所需的路径_Java_Mysql_Hibernate - Fatal编程技术网

Java Hibernate左联接中的联接错误所需的路径

Java Hibernate左联接中的联接错误所需的路径,java,mysql,hibernate,Java,Mysql,Hibernate,的Hibernate查询给了我以下错误 FROM RecordItems t1 LEFT JOIN PropertyValues t2 where t2.property = 'age'ORDER BY CASE WHEN t2.value IS NULL THEN 1 ELSE 0 END, t2.value 异常:预期加入的路径 异常:意外标记:位于第1行附近 下面提供了Hibernate映射和实体详细信息: public class RecordItems implements java

的Hibernate查询给了我以下错误

FROM RecordItems t1
LEFT JOIN PropertyValues t2 where t2.property = 'age'ORDER BY CASE WHEN t2.value IS NULL THEN 1 ELSE 0 END, t2.value
异常:预期加入的路径

异常:意外标记:位于第1行附近

下面提供了Hibernate映射和实体详细信息:

public class RecordItems implements java.io.Serializable {
     private Integer id;
     private String col1;
     private String col2;
     private String col3;
}
public class PropertyValues implements java.io.Serializable {
     private Integer id;
     private RecordItems REC;
     private String property;
     private String value;

}

<?xml version="1.0"?>
<schema package="com.test.p.schema" name="Core Package">
<Class name="RecordItems"table="record_items">
        <id name="id" type="integer"column="ID" ><generator class="native" /></id>
        <property name="col1" type="String"  column="col1" />
        <property name="col2" type="String"  column="col2" />
        <property name="col3" type="String"  column="col3" />

    </Class>
<Class name="PropertyValues "table="property_values">
        <id name="id" type="integer"column="ID" ><generator class="native" /></id>
        <foreign cardinality="many"name="REC" class="RecordItems" column="REC" />
        <property name="property" type="String"  column="property" />
        <property name="value" type="String"  column="value" />

    </Class>
</schema>
公共类RecordItems实现java.io.Serializable{
私有整数id;
私有字符串col1;
私有字符串col2;
私有字符串col3;
}
公共类PropertyValue实现java.io.Serializable{
私有整数id;
私人记录项目记录;
私有财产;
私有字符串值;
}

HQL适用于对象结构,而不是表结构。它必须类似于:FROM RecordItems t1 LEFT JOIN t1。。但是如果不知道您的实体,很难说我的Hibernate对象使用与表列名相同的名称。我将在Descriptione中提供对象详细信息,即使我没有给出where和order子句,我也会从t1上的RecordItems t1 LEFT JOIN Property Value t2中得到此错误。id=t2。请准确地重新读取我的注释
LEFT JOIN t1对象的hibernate映射在哪里?
public class RecordItems implements java.io.Serializable {
     private Integer id;
     private String col1;
     private String col2;
     private String col3;
}
public class PropertyValues implements java.io.Serializable {
     private Integer id;
     private RecordItems REC;
     private String property;
     private String value;

}

<?xml version="1.0"?>
<schema package="com.test.p.schema" name="Core Package">
<Class name="RecordItems"table="record_items">
        <id name="id" type="integer"column="ID" ><generator class="native" /></id>
        <property name="col1" type="String"  column="col1" />
        <property name="col2" type="String"  column="col2" />
        <property name="col3" type="String"  column="col3" />

    </Class>
<Class name="PropertyValues "table="property_values">
        <id name="id" type="integer"column="ID" ><generator class="native" /></id>
        <foreign cardinality="many"name="REC" class="RecordItems" column="REC" />
        <property name="property" type="String"  column="property" />
        <property name="value" type="String"  column="value" />

    </Class>
</schema>