java - How To Define JPA Repository Query with a Join -


I want to make a JOIN query by jpa repository by contacting annotation @, I have three tables.

The original query is:

  Application from user, client, application Choose APP_ID, where user.USCUTOIIIII = Customer. CIS_ID and application.APP_CUSTOMER_ID = Customer.CUS_ID and user.USE_ID = 1;   

I have a table hibernate unit in the mall

so I tried in ApplicationRespository

  @Query (select application from application) Include an INNER JOIN client on c.customer.id = a.customer.id INNER user u u.customer.id = c.customer.id INNER include in application a.user.id = u.id WHERE U.id =: user .id) list & lt; Application & gt; FindApplicationsByUser (@Param ("user") user user);   

say log

unexpected token

Any thoughts, please?

My Table Entity

application.java:

  @Entity @ public class To enable the application BaseSimpleEntity {... @ManyToOne (optional = false) Private customer client; ...}   

Customers.Java: @Entity @ Public Class Customers Enable BaseSimpleEntity {... @OneToMany (Mapped = "Customer") Expands Private List & lt; Users & gt; Users; @OneToMany (mapped = "customer") private list & lt; Application & gt; Applications; ...}

user.java:

  @intite @ public class user Enable BaseSimpleEntity extension {... @ManyToOne (optional = false) Private customer client; ...}   

thx

You do not need JPA In the streams, because the JPA already knows how connected to organizations for mapping annotations are involved

In addition to this, you are selecting applications , which means that your There is no nickname defined in the query.

And your participation does not make any sense.

The query must be

  Select the application from the application. A client joins c.users u where u.id =: userId   

How the Hibernate Documentation works and how it works.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -