tx.begin();
Extent extent = pm.getExtent( BuildDefinitionTemplate.class, true );
Query query = pm.newQuery( extent );
query.declareImports( "import java.lang.String" );
query.declareParameters( "String type" );
query.setFilter( "this.type == type" );
pm.getFetchPlan().addGroup( BUILD_TEMPLATE_BUILD_DEFINITIONS );
List result = (List) query.execute( type );
return result == null ? Collections.EMPTY_LIST : (List) pm.detachCopyAll( result );