Posted by evanx
on July 7, 2007 at 9:13 AM PDT
Another reason why we need properties in the language..
Another reason why we need properties in the language is ... for "native" database queries, e.g.
Person person = createQuery(new WhereLikePredicate(Person.name, "Homer Simpson"));
where Person.name is a property, ie. Person.class has an accessor getName().
In this case, our JPA queries are refactorable, yippee! If you have a real query, it's more obvious (no offense), eg.
SelectQuery query = createSelectQuery();
query.setTitle("Fido's in region %s", regionId);
query.join(dog, organisation, region);
as presented in the The SQL precursor to the Jelly Bean series.
Having JPA queries in strings (and any references in strings) is something that i hope people cannot tolerate going forward!? ;)