I think likely because I was doing a searchword elsewhere and often searches
are matching. In reality I would need an equals there on that query part.
Also about anonymous keys... In the end I think the site I have created could
be massive and the data may have to be on multiple machines. Clustering later
might be an issue, but I am not there yet. I take it that anonymous keys fail
on clusters? I will do looking into that as well on the boards here.
I was not happy with what i had as options before and the rowreader idea has me
really psyched because it is so much more memory efficient then what I was
attempting to create. If you end up pulling 5000, records frequently, that
gets impotant.
----- Original Message -----
From: "Stark, Roman" <[EMAIL PROTECTED]>
Date: Tuesday, November 23, 2004 4:15 pm
Subject: RE: Unique query without using primary key?
> I am still new to OJB and I was just wondering why in the suggestion
> code below you chose
>
> crit.addLike( "state", "somestate" );
>
> Rather than something like
>
> Crit.addEqualTo("state", "somestate");
>
> Or even
>
> Crit.addColumnEqualTo("state", "somestate");
>
> Sorry if this is a stupid question, but I just was wondering why?
>
> Roman
>
>
>
> -----Original Message-----
> From: Danilo Tommasina [EMAIL PROTECTED]
> Sent: Tuesday, November 23, 2004 04:44
> To: OJB Users List
> Subject: Re: Unique query without using primary key?
>
> A ReportQueryByCriteria should do the job:
>
> something like this:
>
> Criteria crit = new Criteria();
> crit.addLike( "state", "somestate" );
> crit.addLike( "<ref To SearchWords>.searchword", "somesearchword" );
>
> ReportQueryByCriteria query = new ReportQueryByCriteria(
> SearchKeys.class, new String [] { "sid" }, crit, true );
>
> PersistenceBroker pb = null;
> try {
> pb = PersistenceBrokerFactory.defaultPersistenceBroker();
>
> ArrayList results = new ArrayList();
> for ( Iterator resultsIt = pb.getReportQueryIteratorByQuery(
> query );
> resultsIt.hasNext(); ) {
> results.add( ((Object []) resultsIt.next())[ 0 ] );
> }
>
> // The results ArrayList now contains all the ids you need
> // Note: always extact the values from the Iterator before closing
> the broker.
>
> } catch ( Exception e ) {
> // Do exception handling
> } finally {
> if ( pb != null ) {
> pb.close();
> }
> }
>
> Replace <ref To SearchWords> with the reference path defined in your
> repository.xml I didn't tested the code, so there are probably syntax
> errors...
>
>
> > I am not getting this. I need a nudge in the right direction.
> >
> > I want to do this query:
> > select distinct sk.sid from searchkeys sk, searchwords sw
> > where sw.searchword="somesearchword"
> > sw.sid = sk.sid
> > sk.state="somestate";
> >
> > table searchkeys:
> > sid <-- unique PK
> > state
> >
> > table searchwords:
> > swid <-- unique PK I wish OJB didn't
> require
> > sid <-- sid in searchkey table
> > searchword
> >
> > searchkeys and searchwords having a 1:n relationship.
> >
> >
> > Right now I both tables mapped according to their characteristics
> which I have done many times before. In the past I have always wanted
> the primary keys and full records.
> >
> > Here I don't want the full records or mapping, but just a collection
> of the unique sid. I would prefer not to get the full records and I
> only require this for read and not write. Imagine I am doing a
> keywordsearch and I just want to know which services match the
> search criteria.
> >
> > Can anybody nudge me in the right direction? Would be great to get
> past this problem. I am trying to inprove the searching on my
> live OJB
> used site by including parts of the Lucene project, but need to be
> ableto do this for it to work.
> >
> > Thanks lots.
> >
> >
> >
> >
> >
> > -----------------------------------------------------------------
> ----
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> -------------------------------------------------------------------
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> -------------------------------------------------------------------
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]