1

I have this select:

SELECT name,surname,role, height, age, nazov_typu, nazov, body 
from users 
join type on type.idTYPE=users.type_idtype and users.team_idteam=?  
join  rola on rola.idROLA=users.rola_idROLA 
join status on status.idSTATUS= users.STATUS_idSTATUS

Could you help me with creating namedQuery?

Alex
  • 16,739
  • 1
  • 28
  • 51
Miloss
  • 29
  • 4
  • http://stackoverflow.com/questions/4517069/what-is-a-named-query I believe this should help you with this question. – JT4U May 16 '16 at 18:47

1 Answers1

1

This should be the Query

@Entity 
@NamedQuery(name ="userQuery",query="SELECT u From User u,Type t,Rola r,Status s WHERE r.rolaId=u.rolaId AND t.typeId=u.typeId and u.teamId=:teamId")
public class User {...

I am assuming that you have other entities available with you like Type Rola and Status. If not and you don't want to create other entities. You can use Native named Query, where you can set the column into this User Entity.

Vijendra Kumar Kulhade
  • 2,217
  • 3
  • 15
  • 25