What about:
Hybridization hyb = Hybridization.getById(dc, hybID);
List<LabeledExtract> list =
hyb.getCreationEvent().getSources().list(dc);
for (LabeledExtract l : list)
{
Sample s = l.getExtract().getSample();
}
The above code should of course be extended with null checks, permission
checks, etc.
/Nicklas
seth redmond wrote:
> Similar to a problem we were having a few weeks back (working from
> hyb->sample) we'd now like to go back in the other direction. However
> whereas before we were going from a Hyb itemquery, linking to a
> labelled extract and using "l.parent.parent.id" to jump to sample I
> can't see any way to go in the other direction ("child.child" is
> essentially the function we need).
> Am I missing something in the API? surely there must be a way to do
> something like this:
>
>
>> ItemQuery<net.sf.basedb.core.Sample> sampleQuery =
>> net.sf.basedb.core.Sample.getQuery();
>> sampleQuery.include(Include.SHARED);
>> sampleQuery.setDistinct(true);
>>
>>
>> sampleQuery.join(Hql.innerJoin("sourceEvents",
>> Item.BIOMATERIALEVENT.getAlias()));
>>
>> sampleQuery.restrict(
>> new Restriction() {
>> public String toQl(Query query, DbControl dc) {
>> return
>> "index("+Item.BIOMATERIALEVENT.getAlias()+") IN " +
>> "(SELECT b.id FROM
>> BioMaterialEventData b " +
>> " WHERE b.hybridization.id =
>> "+hybID+")";
>>
>>
>> }
>>
>> public Collection<? extends QueryElement>
>> getChildren() {
>> return null;
>> }
>> }
>> );
>>
>
> thanks
>
> -s
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
basedb-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/basedb-devel