|
@@ -1,12 +1,15 @@
|
|
package com.example.helloworld.db.hibernate;
|
|
package com.example.helloworld.db.hibernate;
|
|
|
|
|
|
-import com.example.helloworld.db.FortuneDAO;
|
|
|
|
-import com.example.helloworld.db.model.Fortune;
|
|
|
|
import io.dropwizard.hibernate.AbstractDAO;
|
|
import io.dropwizard.hibernate.AbstractDAO;
|
|
-import org.hibernate.SessionFactory;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import org.hibernate.SessionFactory;
|
|
|
|
+import org.hibernate.query.Query;
|
|
|
|
+
|
|
|
|
+import com.example.helloworld.db.FortuneDAO;
|
|
|
|
+import com.example.helloworld.db.model.Fortune;
|
|
|
|
+
|
|
public class FortuneHibernateImpl extends AbstractDAO<Fortune> implements FortuneDAO {
|
|
public class FortuneHibernateImpl extends AbstractDAO<Fortune> implements FortuneDAO {
|
|
|
|
|
|
public FortuneHibernateImpl(SessionFactory factory) {
|
|
public FortuneHibernateImpl(SessionFactory factory) {
|
|
@@ -14,6 +17,6 @@ public class FortuneHibernateImpl extends AbstractDAO<Fortune> implements Fortun
|
|
}
|
|
}
|
|
|
|
|
|
public List<Fortune> list() {
|
|
public List<Fortune> list() {
|
|
- return list(criteria());
|
|
|
|
|
|
+ return list((Query<Fortune>) query("SELECT f FROM Fortune f"));
|
|
}
|
|
}
|
|
}
|
|
}
|