package data;

import java.util.List;

import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Default;
import javax.inject.Named;

import com.darwinsys.todo.model.Task;

import org.apache.deltaspike.data.api.EntityRepository;
import org.apache.deltaspike.data.api.Query;
import org.apache.deltaspike.data.api.Repository;

/**
 * This is a basic DAO-like interface for use by JSF or EJB.
 * Methods are implemented for us by Apache DeltaSpike Data.
 * The methods in the inherited interface suffice for many apps!
 * @author Ian Darwin
 */
@Named("todoList") @Default
@SessionScoped
@Repository 
public interface TodoList extends EntityRepository<Task, Long> {

	@Query(value="select t from Task t order by t.creationDate desc")
	List<Task> findAll();
}

@@ -8,16 +8,75 @@
  data;%0A%0A
+import java.io.Serializable;%0Aimport java.util.Collections;%0A
 import j
@@ -703,16 +703,30 @@
  extends
+ Serializable,
  EntityR
@@ -750,16 +750,101 @@
 ong%3E %7B%0A%0A
+%09// The ordering of Priority is 0=Top..3=Lowest, so sort by prio asc is correct here%0A
 %09@Query(
@@ -886,23 +886,30 @@
 y t.
-creationDate de
+priority asc, t.name a
 sc%22)

Update the sort order