From: Gavin_King/Cirrus%<CI...@ci...> - 2002-06-20 00:03:58
|
>> I think theres an interesting issue here in that while certain things are >> more directly and elegantly expressible in Java, others are much easier to >> express in a query language. I have a problem with some persistence >> solutions that reject the idea of embedding query strings in application >> code and try to construct a query through manipulation of objects. >In general, I'm completely in favor of anything that reduces the amount of >code, and expresses something at a higher semantic level, which query >languages usually do (or there'd be no point to them). But I think one >problem with embedding query strings is that languages like Java aren't very >well suited to it, in the absence of some kind of preprocessing (like SQLJ >or JSQL). Not supporting multi-line strings, and having unnamed >placeholders like "?" which are then dependent on sequence to match up with >external parameters, doesn't help matters. hmmm, that was one thing I had been uncertain about. I always hated the anonymous-looking "?" in JDBC. I had considered allowing "$1", "$2" etc in Hibernate queries but this would have been harder to implement and I decided to go for something that would be familiar to people who only use JDBC. We could still add support for $1, $2, etc if we wanted to. It might even be worth the effort.... Implementing this would be a matter of replacing the $N with a ? and then remapping parameter N to the sequential position of ? Not really very hard to do. >The argument I see is that restricting the number of records returned is not >very closely connected semantically to other things expressed in a query, >which primarily relate to the content of the data being queried. Adding >something like this to the query language might be a convenience, but it >doesn't meaningfully affect the expressivity of the query language. From >there, one could argue about keeping custom languages simple and focused, or >something... :) yes, quite so. |