public List<BuildResult> getBuildResultsForProjectWithDetails( int projectId, long fromDate, int tobuildResultId )
{
PersistenceManager pm = getPersistenceManager();
Transaction tx = pm.currentTransaction();
try
{
tx.begin();
Extent extent = pm.getExtent( BuildResult.class, true );
pm.getFetchPlan().addGroup( BUILD_RESULT_WITH_DETAILS_FETCH_GROUP );
Query query = pm.newQuery( extent );
String parameters = "int projectId, long fromDate";
String filter = "this.project.id == projectId && this.startTime > fromDate";
if ( tobuildResultId > 0 )
{
parameters += ", int buildResultId";
filter += " && this.id < buildResultId";
}
query.declareParameters( parameters );
query.setFilter( filter );
query.setOrdering( "this.id descending" );
List<BuildResult> result;
if ( tobuildResultId > 0 )
{
result = (List<BuildResult>) query.execute( projectId, fromDate, tobuildResultId );
}
else
{
result = (List<BuildResult>) query.execute( projectId, fromDate );
}
result = (List<BuildResult>) pm.detachCopyAll( result );
tx.commit();
return result;
}
finally
{