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:      I have a table hibernate unit in the mall    so I tried in ApplicationRespository    say log    unexpected token     Any thoughts, please?    My Table Entity      application.java:        Customers.Java:        user.java:      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   And your participation does not make any sense.    The query must be    How the Hibernate Documentation works and how it works.    
 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;    
 @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);    
 
 @Entity @ public class To enable the application BaseSimpleEntity {... @ManyToOne (optional = false) Private customer client; ...}    @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; ...}    
 @intite @ public class user Enable BaseSimpleEntity extension {... @ManyToOne (optional = false) Private customer client; ...}    applications , which means that your There is no nickname defined in the query.   
 Select the application from the application. A client joins c.users u where u.id =: userId   
 
  
Comments
Post a Comment