Jakob Braeuchi wrote:
hi vadim,

ojb 1.1 supports QueryByExample where the criteria is built based on the example.

Ok, good. Is there a way to back port these, or some of these, changes back to the OJB 1.0 branch?



I'll have to take a look at 1.1 and see how can I port my patches to that... So far I was working with 1.0 branch.


Vadim


Vadim Gritsenko schrieb:

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 building of criteria has been deferred because we need a pb to do so. in ojb 1.1 this is done in the method preprocess().


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


there's only a simple problem to be solved: the primitive java types :(
my current implementation uses all non-null values of the example object. the correct handling of the primitives still needs to be defined.


jakob

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]



Reply via email to