Simple hql named query that uses a inner join

前端 未结 2 1436
甜味超标
甜味超标 2021-01-03 13:08

I want to do something like this in my domain/entity object :

@Entity
@NamedQueries({
@NamedQuery(name=\"favouriteCats\", query=\"from Cat c inner join on Us         


        
相关标签:
2条回答
  • 2021-01-03 13:21

    Case Issue, Right query would be:

    from Cat c inner join on Usercat uc where uc.isfavourtie = true and uc.user = :user
    

    Note : C in Cat is capital, U in Usercat is capital where as c in Usercat is small and f in isfavourite is small.

    0 讨论(0)
  • 2021-01-03 13:29

    I think this might work for you, but I am guessing your Usercat class here:

    select c from Usercat as uc inner join uc.cat as c where uc.isFavourtie = true and uc.user = :user
    
    0 讨论(0)
提交回复
热议问题