Hi
We're quite extensively using the Criteria API in our application.
Now, we face the problem, that we would need JIRA NH-1946 implemented
in order to satisfy some of our customers requirement.
(i.e. allow to place additional conditions in join conditions with the
Criteria API).
We have a simplified domain model like the following:
Entity
+- Set<Mutation>
+- Set<EntityData>
Currently, we build a criteria like this:
DetachedCriteria dc = DetachedCriteria.For<Entity>().
CreateAlias("Mutations", "m").
CreateAlias("EntityData", "ed",
JoinType.LeftOuterJoin);
dc.Add(Expression.Or(Expression.IsNull("ed.ValidFrom"),
Expression.GeProperty("m.CreationDate", "ed.ValidFrom")));
dc.Add(Expression.Or(Expression.IsNull("ed.ValidTill"),
Expression.LtProperty("m.CreationDate", "ed.ValidTill")));
// more criterias, projections, ...
The problem is, that the above criteria doesn't return an Entity and
Mutation, if the first EntityData present is created after the
mutation.
In SQL, we would like to have something like this (Note: the join
conditions for joining EntityData)
select m.Id as Mid, m.CreationDate as Mc, e.*, ed.*
from
Entity e inner join
Mutation m on m.EntityId = e.Id left outer Join
EntityData ed on (ed.EntityId = e.Id and (ed.ValidFrom is null or
ed.ValidFrom <= m.CreationDate) and
(m.CreationDate < ed.ValidTill or ed.ValidTill is null))
Changing from Criteria to HQL or SQL is not an option for us.
Filter is also not an option, because the join condition depends on
both EntityData and Mutation and not only on EntityData.
Do you see a way to realize the above with the current Criteria API?
Or do you have some hints on how to implement the JIRA NH-1946? (If it
doesn't take multiple weeks to implement, we could provide a patch for
this, but need some help to start)
Thank you very much
Best regards,
Dominic Ullmann
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.