Roberto Lo Giacco wrote:
> Yesterday a friend asked for my support on smartweb and the SearchInfo
> usage. His problem was about the possibility to use SearchInfo to
> constrain a non-simple property, in his case an Enumertion.
>
> Well, I was quite sure the SearchInfo was supporting those properties,
> but I want to prove it to myself and the community so I wrote down a
> test case and....
>
> - SearchInfo supports simple property constraints (as expected)
> - SearchInfo supports non-simple property constraints but NOT over
> collections (as expected)
> - SearchInfo supports enumeration constraints (as expected)
>
> In conclusion: SearchInfo works great and test cases can prove it ;)
>
I have to rectify one of the three preceding statements:
- SearchInfo supports non-simple property constraints but NOT over
collections (as expected) and only considering the connected object
identifying property (not as expected)
Considering you have the following two classes (in simple notation):
class A {
long id;
long display;
B associated;
Collection<B> collected;
Enumeration type;
}
class B {
long id;
long display;
Enumeration type;
}
You can query A using SearchInfo imposing constraints like:
"id", EQUALS, "100"
"display", EQUALS, "something"
"type", EQUALS, "1"
"type", EQUALS, Enumeration.ONE
"associated.id", EQUALS, "5"
You can NOT query A through SearchInfo with constraints like
"associated.type", EQUALS, "1"
"associated.display", EQUALS, "somethingElse"
"collected.id", EQUALS, "10"
"collected.type", EQUALS, "1"
"collected.size", EQUALS, "30"
SearchInfo has been created to support "simple" query construction: more
complex queries should been built using the Hibernate APIs which are
more robust and flexible and SearchInfo has no intention to replace them.
--
Roberto Lo Giacco
Chief Technical Officer
SmartLab s.r.l.
via Spagna, snc - 87036 Rende (CS) - Italy
Mobile: +39 392 8765657
Email: rlo...@sm...
Skype: longisland-75
Web: http://www.smartlab.it
|