What is the correct BDM Custom Query?

1
0
-1

Hello,

Here my BDM (3 objects)

Employee <-1:1 -> Contact (name)

Employee <1-n> Phone (phoneNumber)

Request 1 :

I want to find an EMPLOYE from a CONTACT.NAME

CustomQuery on EMPLOYEE

Is the request is: select e from EMPLOYEE e where e.contact.name = :name ?

Request 2 :

search an EMPLOYE form a Phone Number

CustomQuery on EMPLOYEE

Is the request is:

select e from EMPLOYEE e where e.phone.phonenumber = :phonenumber?

of (source Wikipedia https://en.wikibooks.org/wiki/Java_Persistence/JPQL#Aggregation_functions)

SELECT e FROM Employee e JOIN e.phone p WHERE p.phonenumber = :phonenumber

Request 3

Search all phones attached to a Employee

CustomQuery on PHONE

Select p from PHONE left join EMPLOYEE e.phone where p.phonenumber = :phonenumber

?

Thank you,

No answers yet.
Notifications