On 23 Dec (18:47), Gavin King wrote:

> Would someone have a look over this:
> 
> http://carrierwave.sourceforge.net/doc/Overview.html
> 
> and figure out exactly what it does and how it does it .... it has
> a Hibernate persistence provider, apparently, and seems to
> maybe help with the problem of retrieving a fully initialized
> graph of objects.
> 
> I havn't quite got time to try to get my head around it right now.

Ah, I developed something similar to this for my company: An abstract
Criteria. We faced the problem of decoupling the client from the
Business Facade:

A client view needs all Persons whose firstName is "Foo" and wants the
returned Collection to be a sorted List by "lastName". Imagine other
abstract "queries" or "criterias" like that. 

The EJB Entity Bean approach would be to model methods and finders for
every kind of query. Thats not a solution of course. Our abstract
Criteria is an object query parse tree, you just build the Query in
memory with method calls  like

infix/postfix/projection/selection/whereClause/and-much-more

This gives you a Criteria object which can be passed down to the
Business Facade to retrieve Collections. A method would be defined as
"findPersonsByCriteria(Criteria criteria)".

The DAO (abstract DAO factory) also receives a Criteria. The magic part
is: The Criteria has Generators for, currently: EJB-QL, SQL, HQL. EJB-QL
is pretty useless, but it was an easy start.

The DAO uses the appropriate Generator to produce the real query for its
native implementation, e.g. the HQLGenerator.

So far, we used the Criteria on a couple of projects and never wrote any
SQL or other queries by hand. I like it. :)

CarrierWave has the same idea, but a different implementation and some
features our Criteria doesn't have or would be outside the scope (like
modification of the graph).

-- 
Christian Bauer
[EMAIL PROTECTED]


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to