Extent actorExtent = pm.getExtent(Actor.class, true);
Query query = pm.newQuery(actorExtent, "name == actorName");
query.declareParameters("String actorName");
Collection result = (Collection) query.execute(actorName);
Iterator iter = result.iterator();
Actor actor = null;
if (iter.hasNext()) actor = (Actor)iter.next();
query.close(result);
return actor;