Thumbnail thumb = (Thumbnail) iQuery.findByQuery("select t from Thumbnail as t where t.pixels.id = :id", new Parameters().addId(p.getId()));
Parameters param = new Parameters(); param.addId(p.getId()); param.addInteger("x", sizeX); param.addInteger("y", sizeY);  Thumbnail thumb = iQuery.findByQuery( "select t from Thumbnail as t where t.pixels.id = :id and " + "t.sizeX = :x and t.sizeY = :y", param);
    private Thumbnail getThumbnailMetadata(Pixels p, int sizeX, int sizeY)    {    	// FIXME: We need dimensions here.    	Thumbnail thumb = (Thumbnail)    		iQuery.findByQuery("select t from Thumbnail as t where t.pixels.id = :id",    				new Parameters().addId(p.getId()));    	return thumb;    }