Announcement Announcement Module
Collapse
No announcement yet.
How to retrive clob data using hibernate with springframework Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to retrive clob data using hibernate with springframework

    Hi

    when i try to retrive clob data from oracle 10g using hibernate3.1 and spring 2.0.5 ,i am getting the following error.


    Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
    at org.hibernate.exception.SQLStateConverter.handledN onSpecificException(SQLStateConverter.java:103)
    at org.hibernate.exception.SQLStateConverter.convert( SQLStateConverter.java:91)
    at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:43)
    at org.hibernate.loader.Loader.doList(Loader.java:214 7)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(L oader.java:2028)
    at org.hibernate.loader.Loader.list(Loader.java:2023)
    at org.hibernate.loader.criteria.CriteriaLoader.list( CriteriaLoader.java:95)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.ja va:1569)
    at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl. java:283)
    at com.kerio.ci.incident.dao.IncidentDAO.getTicketByI d(IncidentDAO.java:331)
    ... 75 more
    Caused by: java.sql.SQLException: ORA-04063: view "AXXERA.VW_TICKETS" has errors

    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:166)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe r.java:304)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoe r.java:271)
    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java: 622)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4 CPreparedStatement.java:180)
    at oracle.jdbc.driver.T4CPreparedStatement.execute_fo r_describe(T4CPreparedStatement.java:524)
    at oracle.jdbc.driver.OracleStatement.execute_maybe_d escribe(OracleStatement.java:990)
    at oracle.jdbc.driver.T4CPreparedStatement.execute_ma ybe_describe(T4CPreparedStatement.java:569)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTi meout(OracleStatement.java:1111)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Internal(OraclePreparedStatement.java:3039)
    at oracle.jdbc.driver.OraclePreparedStatement.execute Query(OraclePreparedStatement.java:3080)
    at org.jboss.resource.adapter.jdbc.WrappedPreparedSta tement.executeQuery(WrappedPreparedStatement.java: 236)
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(Ab stractBatcher.java:186)
    at org.hibernate.loader.Loader.getResultSet(Loader.ja va:1668)
    at org.hibernate.loader.Loader.doQuery(Loader.java:66 2)
    at org.hibernate.loader.Loader.doQueryAndInitializeNo nLazyCollections(Loader.java:224)
    at org.hibernate.loader.Loader.doList(Loader.java:214 4)
    ... 81 more
    19:01:56,171 ERROR [ViewTicketController] [Username:not passed in] [No message]
    19:01:56,171 INFO [ViewTicketController] After ViewTicketController onSubmit()
    19:01:56,875 ERROR [BindTag] Neither BindingResult nor plain target object for bean name 'newTicketForm' available as request attribute
    javax.servlet.jsp.JspTagException: Neither BindingResult nor plain target object for bean name 'newTicketForm' available as request attribute
    at org.springframework.web.servlet.tags.BindTag.doSta rtTagInternal(BindTag.java:119)
    at org.springframework.web.servlet.tags.RequestContex tAwareTag.doStartTag(RequestContextAwareTag.java:7 7)
    at org.apache.jsp.WEB_002dINF.jsp.incident.editTicket _jsp._jspService(editTicket_jsp.java:818)
    at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:334)
    at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)

    can any one please provide the solution to solve the problem.
    if you need more details, i will attached with next message.

  • #2
    Please any one can send me the solution

    Comment


    • #3
      Seems like the problem is to do with your table/view schema since a database exception is raised:
      Caused by: java.sql.SQLException: ORA-04063: view "AXXERA.VW_TICKETS" has errors
      Check to make sure that the view's underlying tables have not been altered i.e. column names still
      match those specified in the view schema.

      Comment


      • #4
        Thanks for your reply,i have resolved the problem.
        its an view problem,view not compiled with clob datatype,just i changed to to_char,now working fine.

        Comment


        • #5
          when i am saving data into the oracle 10g database.
          i am getting the following error

          org.hibernate.exception.GenericJDBCException: could not update: [com.kerio.ci.emailalert.dto.IncidentDTO#21398]
          at org.hibernate.exception.SQLStateConverter.handledN onSpecificException(SQLStateConverter.java:103)
          at org.hibernate.exception.SQLStateConverter.convert( SQLStateConverter.java:91)
          at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:43)
          at org.hibernate.persister.entity.AbstractEntityPersi ster.update(AbstractEntityPersister.java:2360)
          at org.hibernate.persister.entity.AbstractEntityPersi ster.updateOrInsert(AbstractEntityPersister.java:2 242)
          at org.hibernate.persister.entity.AbstractEntityPersi ster.update(AbstractEntityPersister.java:2542)
          at org.hibernate.action.EntityUpdateAction.execute(En tityUpdateAction.java:92)
          at org.hibernate.engine.ActionQueue.execute(ActionQue ue.java:248)
          at org.hibernate.engine.ActionQueue.executeActions(Ac tionQueue.java:232)
          at org.hibernate.engine.ActionQueue.executeActions(Ac tionQueue.java:140)
          at org.hibernate.event.def.AbstractFlushingEventListe ner.performExecutions(AbstractFlushingEventListene r.java:298)
          at org.hibernate.event.def.DefaultFlushEventListener. onFlush(DefaultFlushEventListener.java:27)
          at org.hibernate.impl.SessionImpl.flush(SessionImpl.j ava:1000)
          at org.springframework.orm.hibernate3.HibernateAccess or.flushIfNecessary(HibernateAccessor.java:390)
          at org.springframework.orm.hibernate3.HibernateTempla te.execute(HibernateTemplate.java:373)
          at org.springframework.orm.hibernate3.HibernateTempla te.update(HibernateTemplate.java:654)
          at org.springframework.orm.hibernate3.HibernateTempla te.update(HibernateTemplate.java:650)
          at com.kerio.ci.emailalert.dao.EmailAlertDAO.saveTick etDetails(EmailAlertDAO.java:153)
          at o
          Caused by: java.sql.SQLException: operation not allowed: streams type cannot be used in batching
          at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
          at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java

          i am adding my code details as follows

          Comment


          • #6
            Following is my code details:
            applicationContext.xml

            <bean id="nativeJdbcExtractor"
            class="org.springframework.jdbc.support.nativejdbc .SimpleNativeJdbcExtractor"
            lazy-init="true"/>

            <!-- LobHandler for Oracle JDBC drivers -->
            <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.Oracle LobHandler" lazy-init="true">
            <property name="nativeJdbcExtractor"><ref local="nativeJdbcExtractor"/></property>
            </bean>

            <bean id="sessionFactory"
            class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
            <property name="lobHandler" ref="oracleLobHandler" />
            <property name="dataSource" ref="dataSource" />
            <property name="mappingResources">
            <list>
            <value>com/kerio/ci/emailalert/hibernate/emailalert.hbm.xml</value>

            </list>
            </property>
            <property name="hibernateProperties">
            <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Orac le9Dialect</prop>
            <prop key="hibernate.show_sql">false</prop>
            <prop key="hibernate.jdbc.batch_size">100</prop>
            <prop key="hibernate.cache.use_query_cache">false</prop>
            <prop key="hibernate.cache.use_second_level_cache">false </prop>
            <prop key="hibernate.connection.aggressive_release">fals e</prop>
            <prop key="hibernate.connection.release_mode">after_tran saction</prop>
            <prop key="hibernate.current_session_context_class">thre ad</prop>
            </props>
            </property>
            </bean>

            incident.hbm.xml:


            <hibernate-mapping>
            <class name="com.kerio.ci.emailalert.dto.IncidentDTO"
            table="CI_CUST_TICKETS">

            <property name="ticketDetails1" type="clob">
            <column name="TICKET_DETAIL" sql-type="CLOB"/>
            </property>
            </class>
            </hibernate-mapping>

            Comment


            • #7
              DTO class:

              private Clob ticketDetails1;

              public Clob getTicketDetails1() {
              return ticketDetails1;
              }

              public void setTicketDetails1(Clob ticketDetails1) {
              this.ticketDetails1 = ticketDetails1;
              }

              DAO CLASS:

              incidentDTO.setTicketDetails1(Hibernate.createClob (incidentDTO.getTicketDetails())); getHibernateTemplate().update(incidentDTO);

              dennislee please proviude the solution for this error.

              Comment


              • #8
                i need solution ASAP,Please any one can help me,plz plz

                Comment


                • #9
                  See if adding this hibernate property works:

                  Code:
                  <prop key="hibernate.jdbc.batch_size">0</prop>

                  Comment


                  • #10
                    Thanks for reply,actuvally i updated the classes12.jar file to oracle 10g, now its working fine.

                    can you please provide the details,why we need to put batch to zero.

                    Comment

                    Working...
                    X