File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes JDO 2.0: JDOQL Article Series - Part 2 Just Released Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JDO 2.0: JDOQL Article Series - Part 2 Just Released" Watch "JDO 2.0: JDOQL Article Series - Part 2 Just Released" New topic
Author

JDO 2.0: JDOQL Article Series - Part 2 Just Released

Neelan Choksi
Greenhorn

Joined: Feb 06, 2004
Posts: 3
Part 2 of Robin Roos's four-part series on JDOQL has just been released at http://www.theserverside.com/articles/article.tss?l=JDOQueryPart2. The articles in this series illustrate the new capabilities which the forthcoming JDO 2.0 standard is bringing to JDOQL.

Part 1 can be found at http://www.theserverside.com/articles/article.tss?l=JDOQueryPart1.

The spec team has spent a lot of time and effort listening to the community and improving JDOQL. Check it out and judge for yourself.

Neelan
neelan@solarmetric.com


Neelan Choksi<br />SolarMetric, Inc.<br /> <a href="mailto:neelan@solarmetric.com" rel="nofollow">neelan@solarmetric.com</a>
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Neelan I have asked this before, but no comments on this. Is it only me or is it the reality that JDOQL is going on ODMG solution (so looking very alike HQL)?

./pope


blog - InfoQ.com
Robin Roos
author
Greenhorn

Joined: Nov 01, 2004
Posts: 15
Hi Ali

I haven't answered directly since I have no experience of ODMG. We added the single-string form of JDOQL to make queries easier to express.

When named queries are declared in metadata they will use the single-string form, instead of an XML structure with individual elements for each JDOQL clause (filter, ordering, imports) as was first envisaged.

However single-string JDOQL is just a new expression of the same language. The capabilities of single-string queries and API-defined queries are no different. We've merely added tokens to demarcate the various clauses.

Cheers, Robin.


Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0321123808/ref=jranch-20" target="_blank" rel="nofollow">Java Data Objects</a>
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Thanks Robin. I have checked the ODMG site and it seems pretty obvious that single-strings queries are coming from here . I guess I was not wrong when I've said it is in the same line as HQL.

./pope
Robin Roos
author
Greenhorn

Joined: Nov 01, 2004
Posts: 15
Hi Ali

Did you read my query article Part II? What do you think of JDOQL's new power?

Thanks, Robin.
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Shamely me :roll: , I haven't till now... but I promise I will and come back to u.

./pope
Alexandru Popescu
Ranch Hand

Joined: Jul 12, 2004
Posts: 995
Read it. Now the impressions :-).
I think that JDOQL has gone a long way ... in the good direction and it shows now a lot of power. I like very much the idea of objectual querying, i.e.:


This is quite impressive and I find it very neat. But in a way reading the articles I had the feeling that the spec stopped in the middle and proposed:

I consider the above unnecessary API. I am not sure (and I mostly believe that currently this is not possible), but I would write the above:

Why I would like this? Because in this way all the querying is objectual and no additional API is involved. Unfortunately the above hides a little problem too: compile time check. If I change the AuctionItem, than I will discover that my query is broken only at runtime (this maybe has already required a redeploy of the app). So I think the best solution would allow you to build the query actively:

(note the missing quotes; but still a problem as I needed an instance of AuctionItem :-( ).
Hoping you got my point, I would like to move forward.
I like that a lot of aggregate function have been taken into account, but again I feel it is a mix: what does it really mean in objectual model count() or distinct? These are rather DB functions and I would like to have it that way: probably by setting on each or maybe better .

And finally - at least for the moment - I would not go for inventing new notations/notions for something already existing: indeed regexp can be seen as a good selection filter but I haven't seen the (?i) till now. Also why bothering to create unbound variables when an implicit variable would solve it? Here I might be wrong as I see some interesting usage in


these are my first thoughts.

./pope

ps: most probably i will post these on my blog too in to detail 'em
[ November 13, 2004: Message edited by: Ali Pope ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDO 2.0: JDOQL Article Series - Part 2 Just Released