Reputation: 634
I started to work with eclipse link and from what I read in the net the eclipse link is some kind of JPA implementation and you are not working directly with DB code when you are using eclipse link you are working with objects.
My question is what is this if not DB command?
Query q = em
.createQuery("SELECT p FROM Person p WHERE p.firstName = :firstName AND p.lastName = :lastName");
Upvotes: 0
Views: 5819
Reputation: 11298
Its JPA query equivalent to SELECT * FROM PERSON WHERE FIRSTNAME='Stefan' and LASTNAME='Strooves';
further you need to set value for parameters.
Query q = em
.createQuery("SELECT p FROM Person p WHERE p.firstName = :firstName AND
p.lastName = :lastName");
q.setParameter("firstName", "Stefan");
q.setParameter("lastName", "Strooves");
List<Person> resultList = q.getResultList();
Result list contains all the Person
entities matched with query.
Upvotes: 0