FileDocCategorySizeDatePackage
PrototypeQueries.javaAPI DocExample1246Tue Dec 24 13:39:30 GMT 2002com.mediamania.prototype

PrototypeQueries

public class PrototypeQueries extends Object

Fields Summary
Constructors Summary
Methods Summary
public static ActorgetActor(javax.jdo.PersistenceManager pm, java.lang.String actorName)

        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;
    
public static MoviegetMovie(javax.jdo.PersistenceManager pm, java.lang.String movieTitle)

        Extent movieExtent = pm.getExtent(Movie.class, true);
        Query query = pm.newQuery(movieExtent, "title == movieTitle");
        query.declareParameters("String movieTitle");
        Collection result = (Collection) query.execute(movieTitle);
        Iterator iter = result.iterator();
        Movie movie = null;
        if (iter.hasNext()) movie = (Movie)iter.next();
        query.close(result);
        return movie;