Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Pro EJB 3.0: expressiveness query language  RSS feed

 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm not versed in the details of EJB 3.0,
so I may be missing something obvious.

Having used Oracle and sql daily I found
that EJB 2.1 EJBQL was somewhat limiting,
in the sense it does a lot of work for
you on your objects side but on database
side it lacked expressiveness.

Some workarounds were luckily offered by
the application server extensions, like
dynamic queries.

How does EJB 3.0 cope with offering the
expressiveness of SQL on the RDBMS together
with the benefits of ORM on the objects
world?

Kind regards,

Gian
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can read chapter 6 sample, about Java Persistence Query Language,
here : http://www.apress.com/book/bookDisplay.html?bID=10093
 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satou,

Thanks, I'll definitely read that.

Although a subtle detail I would like to know
as well is what lacks in the expressiveness of
the query language.

My experience in SQL with RDMS led me to have
too high expectations of EJB 2.1 query language,
my fault I know . As a consequence small
details, like the inability of EJBQL to include
Date/Time binding in dynamic queries, had a
big impact on the coding time and complexity.

What's really interesting to know is the
authors view of EJB 3.0 querying vs SQL
querying.

It would really help up-front while making some
design decisions to know this kind of things.

Cheers,

Gian Franco Casula
[ August 15, 2006: Message edited by: Gian Franco Casula ]
 
Merrick Schincariol
author
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The query language in the Java Persistence API is far more sophisticated than the original EJB QL introduced in EJB 2.0. Subselects, grouping, outer joins, functions, etc. have all be added or expanded in the new release. Plus, the object-relational notation can express very complicated queries in a compact, yet expressive form.

JPQL can't support all database features, but my experience so far is that it can handle the majority of business queries without issue. For the real nightmare queries, JPA also allows fallback to SQL with mapping to entities.

Cheers,

Merrick
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!