java.lang.NullPointerException: while filtering data using QueryDsl

后端 未结 1 1380
傲寒
傲寒 2021-01-28 12:51

I am using Spring data jpa for creating service. In following code I am using Querydsl for implementing search filter on grid. But for building name I am not able to filter the

1条回答
  •  梦毁少年i
    2021-01-28 13:26

    The NPE that you get is probably related to the limitation of QueryDsl where you cannot exceed four levels.

    Your code exceeds four levels.

    roomTransfer.roomDeptMap.room.building.sBuildName
    

    You can read more on official documentation or related stackoverflow's question.

    In the first link there is a solution to overcome this issue using QueryInit annotation.

    If you do not want to alter your entity class you can perform a join (if possible) with an alias for the first 2 or 3 levels and then use this alias to complete the query.

    0 讨论(0)
提交回复
热议问题