Jakob Braeuchi wrote:
hi vadim,
Vadim Gritsenko schrieb:
Jakob Braeuchi wrote:
i'd prefer to have interfaces for Query, QueryByCriteria,
QueryByExample,
Here, you mean QueryByExample or QueryByIdentity? In getExampleObject in
current
QueryByExample actually is never used as *example*, but rather identity
(PersistenceBrokerImpl, lines 549, 1425 in 1.0.1). So to me, it makes sense to
have:
public interface QueryByIdentity {
Identity getIdentity();
}
and ReportQuery. the current interface Query is a mix
of the first three interfaces.
Does it mean you plan to trim Query interface?
yes, it will onlycontain getSearchClass() and the paging information.
So that means that SqlQueryStatement will depend on QueryByCriteria
interface
instead of QueryByCriteria class, that's good.
It also means that QueryByExampleImpl class should implement both QueryByExample
interface and QueryByCriteria interface. Am I on track (please also see below)?
how would your extended Query-interface look like ?
So far it's class, named QueryByFKCriteria, and it is simplification
of the QueryByCriteria class. It takes (Class, String[] names,
String[] values) as constructir arguments and internally creates
Criteria in the form of "name=value AND ...".
imo there's already a QueryByIdentity that does something similar.
Some questions regarding this.
I see that current QueryByIdentity class does not build a Criteria out of the
identity object. Do you think it should build one in the way similar to
QueryByCriteria.buildCriteria [1]? It should consider only primary key fields,
not all fields.
The query I need actually can be an extension of the QueryByIdentity class, with
only one difference: instead of building criteria only for primary key fields,
it will build criteria using all available fields, same as in
QueryByCriteria.buildCriteria [1]. So, it seems to me that it can be named
QueryByExample and it should extend QueryByIdentity.
Given the above, both these Queries would implement QueryByCriteria interface -
if you to split Query interface into three different once - this will provide a
way to execute these queries using SqlQueryStatement.
Does the above make sense to you?
Thanks,
Vadim
[1] Around line 150 in QueryByCriteria:
private static Criteria buildCriteria(Object anExample)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]