CriteriaTransformer don't clone a DetachedCriteria with sub DetachedCriteria

Description

Criteria transformer is currently broken. If I have an Entity A that has a relation to an Entity B and I'm using a DetachedCriteria to query all entities A that have some specific Bs, then the child subcriteria has a wrong root Entity.
DetachedCriteria main = DetachedCriteria.For(A);
DetachedCriteria sub = main.CreateCriteria(b);
sub.Add(Restrictions.Eq("foo", value)) ;

CriteriaTransformer.Clone(main).GetExecutableCriteria(session).List()

will throw an exception which states that "foo" is not a property on A.

I've attached a personal test fixture .

Environment

None

Attachments

1
  • 24 Jul 2008, 11:45 AM

Activity

Show:

Fabio Maulo July 25, 2008 at 9:29 AM

> Is Trunk stable enough to be used in production ?
Take a look to the "Fix version"... It was fixed in 2.0.0RC1 too.

> And a short question I have : Is there any reason why the Clone method is not on the DetachedCriteria class itself?
In the trunk it was implemented well and for that the issues was there only in the 2.0.0 branch.
In the trunk ICriteria and DetachedCriteria implement IClonable

Ciprian Sabolovits July 25, 2008 at 5:21 AM

Thanks. Is Trunk stable enough to be used in production ?
And a short question I have : Is there any reason why the Clone method is not on the DetachedCriteria class itself?
Thanks.

Fabio Maulo July 24, 2008 at 11:18 PM

The problem is present only in the 2.0.0 branch; the trunk is ok

Fabio Maulo July 24, 2008 at 4:25 PM

Priority Blocker mean : Blocks development and/or testing work, production could not run (the subject is NH project)

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created July 24, 2008 at 11:45 AM
Updated July 25, 2008 at 9:29 AM
Resolved July 24, 2008 at 11:57 PM
Who's Looking?