春天数据@query join

时间:2018-09-17 11:36:25

标签: mysql jpa spring-data-jpa

我有三个具有以下关系的实体

FormEntity OnetoOne ValidationEntity 
FormEntity OnetoMany MszEntity 

msz实体具有一些基于语言ID的消息,例如ENG,HIN,RSA,CHN。所以我创建了JPQL查询,但问题是它返回了所有语言记录

@Query

@Query("select a From FormEntity As a join a.ValidationEntity As b join 
 a.MszEntity as c where a.formId =:formId and 
 c.validationLanguageId.languageId='ENG'")

回复

 {
        "formFieldId": 1,
        "formId": "Login",
        "formFields": "username",
        "ValidationEntity ": {
            "formFieldId": 1,
            "required": true,
            "numberMin": 2
        },
        "spdFormFieldsValidationMszInfo": [
            {
                "formFieldId": 1,
                "versionId": 1,
                "languageId": "ENG",
                "required": "ENG- Please Enter Username",
                "numberMin": "ENG- Min 2 Number Required"
            },
            {
                "formFieldId": 1,
                "versionId": 1,
                "languageId": "CHA",
                "required": "CHA- Please Enter Username",
                "numberMin": "CHA- Min 2 Number Required"
            }
        ]
 }

预期结果

     {
        "formFieldId": 1,
        "formId": "Login",
        "formFields": "username",
        "ValidationEntity ": {
            "formFieldId": 1,
            "required": true,
            "numberMin": 2
        },
        "spdFormFieldsValidationMszInfo": [
            {
                "formFieldId": 1,
                "versionId": 1,
                "languageId": "ENG",
                "required": "ENG- Please Enter Username",
                "numberMin": "ENG- Min 2 Number Required"
            }
        ]
 }

0 个答案:

没有答案