JSF データテーブルに遅延読み込みを実装しようとしています。アプリケーションは JSF2.0 を使用しています。春 3 と休止状態 4。
私はDAOに次のものを持っています
@Override
public int getRequestCount() {
Query query = entityManager.createNamedQuery("Request.count");
return ((Long) query.getSingleResult()).intValue();
}
そしてManagedBeanで私が持っている
@Named("reqMB")
@Scope("request")
public class RequestManagedBean implements Serializable {
// other code .....
lazyModel.setRowCount(getRequestService().getRequestCount());
....
return lazyModel;
エンティティクラスで
@Entity
@Table(name = "V_REQUESTS")
@NamedQueries({
@NamedQuery(name = "Request.count", query = "SELECT COUNT(r) FROM <viewname> r")
})
public class Request {
私が直面している問題は、アプリケーションを weblogic 10.3.6 にデプロイしようとすると、次の例外が発生することです。
Error creating bean with name 'requestDAOImpl': Injection of
autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: private org.hibernate.SessionFactory
net.test.request.dao.RequestDAOImpl.sessionFactory; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'SessionFactory' defined in ServletContext resource
[/WEB-INF/applicationContext.xml]: Invocation of init method failed;
nested exception is org.hibernate.HibernateException:
Errors in named queries: Request.count
この問題を解決するにはどうすればよいですか?
別のポイントは、次を使用する代わりに、遅延読み込みの行数を取得する他の方法はありますか?
@NamedQueries({
@NamedQuery(name = "Request.count", query = "SELECT COUNT(r)
FROM vw_request r")})
ありがとう