// select c from Customer c where c.firstName = 'Vincent'
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<Customer30> query = builder.createQuery(Customer30.class);
Root<Customer30> c = query.from(Customer30.class);
query.select(c).where(builder.equal(c.get(Customer30.firstName), "Vincent"));
In this
test case, the Eclipse_3.6
IDE gives a compliation error at the last line where it says the field Customer30.firstName is not visible.
In the Class Customer30, the field firstName is a private instance variable. This is in a book by a highly respected
Java EE architect and given as an
example. I know I could change the field to public or some such, but I don't understand the syntax. Customer30 is a class name, not an instance name.
firstName is a private field in the class and is not static. What is intended here? Is this something that I don't have set right in Eclipse so that it recognizes it?
Or, is it just wrong? If so, what is the correct syntax to accomplish this?