facebook

Implementing LazyDataModel with Scaffolding for CRUD + JSF

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #329458 Reply

    shrutee
    Member

    Hi

    I have Table in the database in which theer are more tahn 6K records.
    After scaffolding for CRUD I implemented LazyDataModel.
    Pasting all the files and error logs here.

    Please help.

    Attachments:
    You must be logged in to view attached files.
    #329494 Reply

    support-swapna
    Moderator

    shrutee,

    Sorry that you are seeing this issue.
    I have escalated it to a dev team member. They will get back to you.

    #329496 Reply

    shrutee
    Member

    Thanks a lot Swapna.

    Hope it will get resolved soon.

    #329542 Reply

    cconway
    Member

    Hi shrutee,

    According to the error log, the system is unable to create the named query associated with com.test.dao.Dfp1CarClassDAOImpl.findAllDfp1CarClasss():

    java.lang.NullPointerException
    at org.skyway.spring.util.dao.AbstractJpaDao.createNamedQuery(AbstractJpaDao.java:214)
    at org.skyway.spring.util.dao.AbstractJpaDao.createNamedQuery(AbstractJpaDao.java:205)
    at com.test.dao.Dfp1CarClassDAOImpl.findAllDfp1CarClasss(Dfp1CarClassDAOImpl.java:247)
    at com.test.datamodel.LazyCarList.fetchLazyData(LazyCarList.java:27)

    The line in AbstractJPADao.java that is failing with a Null Pointer Exception is this:
    Query query = getEntityManager().createNamedQuery(queryName);

    Likely the EntityManager is null because you’ve tried calling the dao method from a bean that is not properly wired into spring. In your LazyCarList.fetchLazyData, you are constructing a DaoImpl. When you manually construct the DaoImpl it doesn’t get the spring context and the entity manager is not autowired in.

    Can you move your method into the existing scaffolded objects, maybe the scaffolded class annotated with @Component? Or, possibly try annotating the LazyCarList with @Component and then use autowiring for the dao? You should find examples in the scaffolded code of how a dao is autowired in and then called.

    HTH

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Implementing LazyDataModel with Scaffolding for CRUD + JSF

You must be logged in to post in the forum log in