[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [dali-dev] JPQL query generation?
|
The topic of a query builder has come up but I think the current
thinking is more along the lines of code assist when writing a query.
Of course this is far from decided and code assist and a query builder
would be complementary. Do I hear you volunteering? :-)
Shaun
Tom Mutdosch wrote:
Hi Shaun,
Thanks for the feedback. You've certainly convinced me of the virtues
of object-based JPQL queries :) It sounds as if I definitely want to
avoid SQL queries if there's no real reason to use them.
That said, when you mentioned JPQL support is on the feature backlog
for the future; do you think that support would likely entail some
sort of query builder, or something along those lines?
Thanks
Tom
Shaun Smith wrote:
Hi Tom,
There isn't a visual query builder in Dali but JPQL support is on the
feature backlog.
I really wouldn't recommend SQL queries. They're there as a last
resort. You lose a number of advantages of JPA including
encapsulation of the data model. You'll be coupling your code
(queries) to the data model. Coupling should be limited to your
mappings. Mappings can adapt to data model changes (and Dali will
detect them), and your queries can continue to work without change
since you're querying on the object model. Also, JPA persistence
providers parse JPQL and can do things like avoid database round
trips by using a cache. A primary key query is an obvious one. If
what you want is in the cache and you know it's reliable why go to
the database? When using SQL your provider will just pass it along
and process the results so you lower the value of the cache. The big
issue IMHO is the unnecessary coupling of queries to the data model
and the brittleness it introduces. I've seen database migrations from
DB/2 to Oracle of two applications in a workflow, one using TopLink,
one using direct SQL. The SQL based application was way more
expensive to port. They had to go over every line of SQL whereas the
TopLink based application required the mappings adjusted (minimally I
might add) and the application ran. Theory is nice but seeing it play
out in real life made the advantage of object based queries concrete.
Shaun
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev
--
Shaun Smith
Principal Product Manager
Oracle TopLink
shaun.smith@xxxxxxxxxx