Announcement Announcement Module
Collapse
No announcement yet.
Data access failure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Data access failure

    Hi All,

    I just have started learning spring roo , i have checked the examples (timer,vote,...) and i have successed to run them ..

    I have also made my own simple example and it worked fine......

    now I am facing the following application , here is the roo script
    Code:
    project --topLevelPackage com.springsource.category.types
    
    persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT
    
    entity --class ~.Category --testAutomatically
    field string categoryName --notNull 
    field string description 
    field reference --fieldName categoryParent --type ~.Category 
    
    controller all --package ~.web
    
    logging setup --level DEBUG --package WEB
    logging setup --level DEBUG
    
    perform package
    perform eclipse
    the idea of the above is that the category may contains 0,1,2,...,n subcategories , and each subcategory contains 0,1,2,...n subsubcategories , and etc... ( all categories,subcategories,subsubcategories..... should be stored in the same table)


    but when i run the war file it display some error ( when i clicke "list of categories")
    Code:
    Data access failure
    
    Sorry, a problem occurred while accessing the database.
    
    Details
    
    Exception Message
    org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    
    -Exception Stack Trace
    org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:312)
    org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect.ajc$afterThrowing$org_springframework_orm_jpa_aspectj_JpaExceptionTranslatorAspect$1$18a1ac9(JpaExceptionTranslatorAspect.aj:15)
    com.springsource.category.types.Category_Roo_Entity.findAllCategorys_aroundBody4(Category_Roo_Entity.aj:88)
    com.springsource.category.types.Category_Roo_Entity.ajc$interMethod$com_springsource_category_types_Category_Roo_Entity$com_springsource_category_types_Category$findAllCategorys(Category_Roo_Entity.aj:1)
    com.springsource.category.types.Category.findAllCategorys(Category.java:1)
    com.springsource.category.types.Category_Roo_Entity.ajc$interMethodDispatch1$com_springsource_category_types_Category_Roo_Entity$com_springsource_category_types_Category$findAllCategorys(Category_Roo_Entity.aj)
    com.springsource.category.types.web.CategoryController_Roo_Controller.ajc$interMethod$com_springsource_category_types_web_CategoryController_Roo_Controller$com_springsource_category_types_web_CategoryController$createForm(CategoryController_Roo_Controller.aj:31)
    com.springsource.category.types.web.CategoryController.createForm(CategoryController.java:1)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
    org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
    org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
    org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
    org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
    org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
    org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
    org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
    org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
    org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:71)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    java.lang.Thread.run(Thread.java:619)

    I will be thankful if any one could help me...

  • #2
    I remember hitting this issue with an earlier roo relase, it didn't like recursive entities, what version of ROO are you using?

    Comment


    • #3
      Thanks alot for the reply ,

      I am using the version 1.0.2.RELEASE [rev 638].

      Comment


      • #4
        Try 1.1, if it doesn't work log an issue providing your roo script. When I looked yesterday I couldn't find any issues for this.

        Comment


        • #5
          Thanks alot for your reply ,

          I have used 1.1 but still am getting the same error .

          here is the roo script :
          Code:
          project --topLevelPackage com.springsource.category.types
          
          persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT
          
          entity --class ~.Category --testAutomatically
          field string categoryName --notNull 
          field string description 
          field reference --fieldName categoryParent --type ~.Category 
          
          controller all --package ~.web
          
          logging setup --level DEBUG --package WEB
          logging setup --level DEBUG
          
          perform package
          perform eclipse
          and the error is :
          Code:
          2010-07-21 16:26:33,819 [http-8080-2] DEBUG org.hibernate.util.JDBCExceptionReporter - could not execute query [select category0_.id as id0_, category0_.version as version0_, category0_.category_name as category3_0_, category0_.category_parent as category5_0_, category0_.description as descript4_0_ from category category0_]
          java.sql.SQLException: Column not found: CATEGORY0_.CATEGORY_PARENT in statement [select top ? category0_.id as id0_, category0_.version as version0_, category0_.category_name as category3_0_, category0_.category_parent as category5_0_, category0_.description as descript4_0_ from category category0_]
          	at org.hsqldb.jdbc.Util.throwError(Unknown Source)
          	at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
          	at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
          	at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:248)
          	at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:302)
          	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
          	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
          	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
          	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
          	at org.hibernate.loader.Loader.doQuery(Loader.java:673)
          	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
          	at org.hibernate.loader.Loader.doList(Loader.java:2213)
          	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
          	at org.hibernate.loader.Loader.list(Loader.java:2099)
          	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
          	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
          	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
          	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
          	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
          	at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:65)
          	at com.springsource.category.types.Category_Roo_Entity.findCategoryEntries_aroundBody8(Category_Roo_Entity.aj:97)
          	at com.springsource.category.types.Category_Roo_Entity.ajc$interMethod$com_springsource_category_types_Category_Roo_Entity$com_springsource_category_types_Category$findCategoryEntries(Category_Roo_Entity.aj:1)
          	at com.springsource.category.types.Category.findCategoryEntries(Category.java:1)
          	at com.springsource.category.types.Category_Roo_Entity.ajc$interMethodDispatch1$com_springsource_category_types_Category_Roo_Entity$com_springsource_category_types_Category$findCategoryEntries(Category_Roo_Entity.aj)
          	at com.springsource.category.types.web.CategoryController_Roo_Controller.ajc$interMethod$com_springsource_category_types_web_CategoryController_Roo_Controller$com_springsource_category_types_web_CategoryController$list(CategoryController_Roo_Controller.aj:46)
          	at com.springsource.category.types.web.CategoryController.list(CategoryController.java:1)
          	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          	at java.lang.reflect.Method.invoke(Method.java:585)
          	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710)
          	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:167)
          	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414)
          	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
          	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
          	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
          	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
          	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
          	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
          	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
          	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
          	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
          	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
          	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
          	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
          	at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
          	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
          	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
          	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
          	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
          	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:71)
          	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
          	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
          	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
          	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          	at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
          	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
          	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
          	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
          	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
          	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
          	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
          	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
          	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
          	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
          	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          	at java.lang.Thread.run(Thread.java:595)

          Comment


          • #6
            in your hibernate.cfg.xml, is autoddl set to 'create'?

            Comment


            • #7
              Thanks for the reply ,


              autoddl is already set to 'create' . it is like that :
              Code:
              <property name="hibernate.hbm2ddl.auto" value="create"/>

              Comment

              Working...
              X