JBoss Community

How to add the @NamedQuery in Entity class

created by Muhammad Firdaus in EJB3 - View the full discussion

Hello All,

 

I want to ask if someone know how to write the query inside @NamedQuery.

 

The query is joining 3 tables S below:

compound_property

logical_operator

rtp_goal

rtp

 

-rtp is the parent table for rtp_goal.

-compound_property and logical_operator are both independent table which referencing inside rtp_goal table.

 

My plain SQL query is like below:

SELECT cp.compound_property_name,lo.logical_operator_name,cp.compound _property_value,cp.component_property_unit

FROM ComponentProperty cp,LogicalOperator lo,Rtp r,RtpGoal rg

WHERE cp.compound_property_id = rg.compound_property_id

AND lo.logical_operator_id = rg.logical_operator_id

AND r.rtp_id = rg.rtp_id;

 

I tried to insert the above query inside @NamedQueries but it provides error as below:

https://community.jboss.org/servlet/JiveServlet/downloadImage/2-799823-20376/450-178/namedquery+error.jpg

Reply to this message by going to Community

Start a new discussion in EJB3 at Community