Transaction tx = pm.currentTransaction();
tx.begin();
Actor actor = PrototypeQueries.getActor(pm, actorName);
if( actor == null ){
System.out.print("There is no actor named ");
System.out.println(actorName);
tx.rollback();
return;
}
Set roles = actor.getRoles();
Iterator iter = roles.iterator();
while( iter.hasNext() ){
Role role = (Role) iter.next();
String roleName = role.getName();
Movie movie = role.getMovie();
String title = movie.getTitle();
System.out.print(title);
System.out.print(";");
System.out.println(roleName);
}
tx.commit();