Extent personExtent = pm.getExtent(
com.mediamania.content.MediaPerson.class, false);
Query query = pm.newQuery(personExtent, "mediaName == person");
query.declareParameters("String person");
Collection result = (Collection) query.execute(person);
Iterator iter = result.iterator();
MediaPerson mediaPerson =
(MediaPerson) (iter.hasNext() ? iter.next() : null);
query.close(result);
return mediaPerson;