custom query to get data from parent business object into child business object

1
0
-1

Hello ,

i have tow business object , the parent called : CreationBC

and the second is : ProduitCreationBC

the parent business object (CreationBC ) has this attributes :

reference -> string

products -> ProduitCreationBC (multiple)

in H2 browser i use this sql to retrieve data from the table ProduitCreationBC and retrieve form each record the attribute of it parent

SELECT PRODUITCREATIONBC.*, CREATIONBC.reference
FROM PRODUITCREATIONBC
JOIN CREATIONBC ON PRODUITCREATIONBC.creationbc_pid = CREATIONBC.persistenceid;

i get a list of product and each records contain the attribute "reference" of his parent table from "CreationBC"

how can i convert this sql to jpql custom query , i did this but it didn't work , any help please

SELECT p, c.reference
FROM ProduitCreationBC p
JOIN p.creationBC c 

No answers yet.
Notifications