Well, i'm trying to keep my apps "persistence layer agnostic" by abstracting out all reading/writing functionality... The problem is that there are so many features that Hibernate has that Castor doesn't have, that makes me wonder if it's even worth trying to treat the two as "equals".
Question:
The API docs for Hibernate 2.1 beta 4 are a bit sparse regarding Criteria.createAlias(String, String) and Criteria.createCriteria(String). If I wanted to implement a join (nested property lookup), what would the code look like?
For example, what would I translate something like:
Expression.eq("survey.question.answer.id", new Long(1)) to using Criteria.createAlias or createCriteria?
My interface for my "generic" querying mechanism has a function:
addWhereClause(String property, String comparison, Object value)
This works pretty directly in Castor. I have to translate these into the appropriate Expression.eq...etc statements in Hibernate (no big deal). I really don't want to use HQL, since it's not as OO as the Criteria API. I wrote a translator for Castor's OQL. It was a ton of work, and I don't want to have to go through that again :)
|