O'Reilly logo

Java Data Objects by Craig Russell, David Jordan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The com.mediamania.content package

This package includes classes that model information about the media content that is sold or rented at Media Mania stores.

com.mediamania.content.ContentQueries

 1    package com.mediamania.content;
 2    
 3    import java.util.Iterator;
 4    import java.util.Collection;
 5    import javax.jdo.*;
 6    
 7    public class ContentQueries {
 8        public static Studio getStudioByName(PersistenceManager pm,
 9                                             String studioName) {
10            Extent studioExtent = pm.getExtent(com.mediamania.content.Studio.class,
11                                               false);
12            Query query = pm.newQuery(studioExtent, "name == studioName");
13            query.declareParameters("String studioName");
14            Collection result = (Collection) query.execute(studioName);
15            Iterator iter = result.iterator(  );
16            Studio studio = (Studio) (iter.hasNext() ? iter.next(  ) : null);
17            query.close(result);
18            return studio;
19        }
20        public static MediaPerson getMediaPerson(PersistenceManager pm,
21                                                 String person) {
22            Extent personExtent = pm.getExtent(
23                           com.mediamania.content.MediaPerson.class, false);
24            Query query = pm.newQuery(personExtent, "mediaName == person");
25            query.declareParameters("String person");
26            Collection result = (Collection) query.execute(person);
27            Iterator iter = result.iterator(  );
28            MediaPerson mediaPerson =
29                (MediaPerson) (iter.hasNext() ? iter.next(  ) : null);
30            query.close(result);
31            return mediaPerson;
32        }
33    }

com.mediamania.content.Game

 1 package com.mediamania.content; 2 3 import java.util.Date; 4 5 public class Game extends MediaContent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required