-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: JDBC Exception
PostPosted: Thu Sep 08, 2005 11:02 am 
Newbie

Joined: Tue Sep 06, 2005 9:50 am
Posts: 13
Hi all,

I'm still wrestling with criteria.
I put all the relevent information I found below.
The code sometimes works and sometimes doesn't. Right now the code should only create the criteria expression with ppoId as filter.

Hibernate version:
2.1.8

Mapping documents:

Domain.hbm.xml:

Code:
<class name="nl.upi.workmate.pojo.Domain" table="DOMAIN">
       <meta attribute="class-description">
        Represents a single domain in the workmate database.
        @author Ergin Er
      </meta>
      
      <id name="id" type="int" column="ID">
        <meta attribute="scope-set">protected</meta>
        <generator class="native"/>
      </id>
      
      <property name="ppoId" type="int">
        <column name="PPO_ID" not-null="true" index="FK_DOMAIN_PPO_ID_IDX" />
      </property>
      
      <property name="name" type="string">
        <column name="NAME" not-null="true" length="250"/>
      </property>
      
      <property name="isAuthorized" type="string">
        <column name="IS_AUTHORIZED" not-null="true" length="1"/>
      </property>
      
      <property name="isBlocked" type="string">
        <column name="IS_BLOCKED" not-null="true" length="1"/>
      </property>
      
      <many-to-one name="ppo"
      class="nl.upi.workmate.pojo.Ppo"
      column="PPO_ID"
      not-null="true"
      insert="false"
      update="false"/>
      
      <set name="workmates" inverse="true">
         <key column="DOMAIN_ID"/>
         <one-to-many class="nl.upi.workmate.pojo.Workmate"/>
      </set>

Workmate.hbm.xml:

Code:
<class name="nl.upi.workmate.pojo.Workmate" table="WORKMATE">
    <meta attribute="class-description">
      Represents a single activity in the workmate database.
      @author Arthur Logtenberg
    </meta>

    <id name="id" type="int" column="ID">
      <meta attribute="scope-set">protected</meta>
      <generator class="native"/>
    </id>

    <property name="ppoId" type="int">
      <column name="PPO_ID" not-null="true" index="FK_WORKMATE_PPO_ID_IDX" />
    </property>

    <property name="domainId" type="int">
      <column name="DOMAIN_ID" not-null="true" index="FK_WORKMATE_DOMAIN_ID_IDX" />
    </property>

    <property name="firstname" type="string">
      <column name="FIRSTNAME" not-null="true" length="50"/>
    </property>

    <property name="middlename" type="string">
      <column name="MIDDLENAME" not-null="false" length="10"/>
    </property>

    <property name="lastname" type="string">
      <column name="LASTNAME" not-null="true" length="250"/>
    </property>

    <property name="gender" type="string">
      <column name="GENDER" not-null="true" length="50"/>
    </property>

    <property name="dateOfBirth" type="date">
      <column name="DATE_OF_BIRTH" not-null="true"/>
    </property>

    <property name="zipcodeHome" type="string">
      <column name="ZIPCODE_HOME" not-null="true" length="7"/>
    </property>

    <property name="zipcodeWork" type="string">
      <column name="ZIPCODE_WORK" not-null="true" length="7"/>
    </property>

    <property name="education" type="string">
      <column name="EDUCATION" not-null="true" length="250"/>
    </property>

    <property name="maritalStatus" type="string">
      <column name="MARITAL_STATUS" not-null="true" length="50"/>
    </property>

    <property name="isAccepted" type="string">
      <column name="IS_ACCEPTED" not-null="true" length="1"/>
    </property>

    <property name="hasProfile" type="string">
      <column name="HAS_PROFILE" not-null="true" length="1"/>
    </property>
   
   <property name="isActive" type="string">
      <column name="IS_ACTIVE" not-null="true" length="1"/>
    </property>
   
   <property name="profile" type="string">
      <column name="PROFILE" not-null="false" length="50"/>
    </property>
         
    <property name="createDate" type="date">
      <meta attribute="field-description">When the record was created</meta>
      <column name="CREATE_DATE" not-null="true"/>
    </property>

    <property name="updateDate" type="date">
      <meta attribute="field-description">When the record was last updated</meta>
      <column name="UPDATE_DATE" not-null="true"/>
    </property>
   
   <many-to-one name="domain"
      column="DOMAIN_ID"
      class="nl.upi.workmate.pojo.Domain"
      not-null="true"
      insert="false"
      update="false"/>

  </class>

Code between sessionFactory.openSession() and session.close():

Code:
Criteria dom =   session.createCriteria(Domain.class)
            .add( Expression.like("ppoId", (Integer) workmate.getPpoId()));
         if (!workmate.getDomainId().equals(new Integer(0)))   {
               dom.add( Expression.like("id", workmate.getDomainId().toString()));
         }         
         if(!search.equalsIgnoreCase("")) {
            dom.add( Expression.like("name", search, MatchMode.ANYWHERE));
         }
         
         Criteria wm = dom.createCriteria("workmates");
         if (!search.equalsIgnoreCase("")) {
                  wm.add( Expression.like( "firstname", search, MatchMode.ANYWHERE));
                  wm.add( Expression.like( "lastname", search, MatchMode.ANYWHERE));
         }          
         if (workmate.getIsActive() != null) {
                  wm.add( Expression.like( "isActive" , workmate.getIsActive(), MatchMode.ANYWHERE));
         }
            wms = wm.list();

Full stack trace of any exception that occurs:
[16:43:58,515] WARN JDBCExceptionReporter:57 - SQL Error: 1401, SQLState: 23000

[16:43:58,531] ERROR JDBCExceptionReporter:58 - ORA-01401: inserted value too large for column

[16:43:58,531] WARN JDBCExceptionReporter:57 - SQL Error: 1401, SQLState: 23000

[16:43:58,546] ERROR JDBCExceptionReporter:58 - ORA-01401: inserted value too large for column

[16:43:58,546] WARN JDBCExceptionReporter:57 - SQL Error: 1401, SQLState: 23000

[16:43:58,546] ERROR JDBCExceptionReporter:58 - ORA-01401: inserted value too large for column

[16:43:58,562] WARN JDBCExceptionReporter:57 - SQL Error: 1401, SQLState: 23000

[16:43:58,562] ERROR JDBCExceptionReporter:58 - ORA-01401: inserted value too large for column

[16:43:58,562] ERROR SessionImpl:2400 - Could not synchronize database state with session
[16:53:20,687] ERROR PpoAdminEmployeesAction:65 - Could not execute JDBC batch update
net.sf.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
at net.sf.hibernate.exception.ErrorCodeConverter.handledNonSpecificExcep
tion(ErrorCodeConverter.java:90)
at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:79)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at net.sf.hibernate.impl.BatcherImpl.convert(BatcherImpl.java:328)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:135)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2438)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2393)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1821)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3652)
at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
at net.sf.hibernate.impl.CriteriaImpl$Subcriteria.list(CriteriaImpl.java:85)
at nl.upi.workmate.persistence.PpoBD.getWorkmates(PpoBD.java:517)
at nl.upi.workmate.struts.ppo.PpoAdminEmployeesAction.unspecified(PpoAdminEmployeesAction.java:60)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:256)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:115)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:99)
at nl.upi.workmate.persistence.Persistence.doFilter(Persistence.java:132)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:163)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocatio
n.java:208)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:259)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
at com.caucho.util.ThreadPool.run(ThreadPool.java:423)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.BatchUpdateException: ORA-01401: inserted value too large for column

at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:458)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3907)
at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:128)
... 26 more

Name and version of the database you are using:

Oracle 9i

The generated SQL (show_sql=true):

no sql is shown before the error
When sometimes the codes runs through I get the following:

Hibernate: select this.ID as ID2_, this.PPO_ID as PPO_ID2_, this.NAME as NAME2_, this.IS_AUTHORIZED as IS_AUTHO4_2_,
this.IS_BLOCKED as IS_BLOCKED2_, ppo1_.ID as ID0_, ppo1_.NAME as NAME0_, ppo1_.COC_NR as COC_NR0_,
ppo1_.REP_NAME as REP_NAME0_, ppo1_.DEBTOR_NR as DEBTOR_NR0_, ppo1_.INVOICE_NAME as INVOICE_6_0_,
ppo1_.INVOICE_ADDRESS as INVOICE_7_0_, ppo1_.INVOICE_ZIPCODE as INVOICE_8_0_, ppo1_.INVOICE_CITY as INVOICE_9_0_,
ppo1_.ACCOUNT_NR as ACCOUNT_NR0_, ppo1_.VISIT_ADDRESS as VISIT_A11_0_, ppo1_.VISIT_ZIPCODE as VISIT_Z12_0_,
ppo1_.VISIT_CITY as VISIT_CITY0_, ppo1_.NAME_ADMIN as NAME_ADMIN0_, ppo1_.EMAIL_ADMIN as EMAIL_A15_0_,
ppo1_.TEL_ADMIN as TEL_ADMIN0_, ppo1_.IS_ACCEPTED as IS_ACCE17_0_, ppo1_.RECEIVED_CONTRACT as RECEIVE18_0_,
ppo1_.DATA_CHECKED as DATA_CH19_0_, ppo1_.AUTOM_INCASSO as AUTOM_I20_0_, ppo1_.STATUS as STATUS0_,
ppo1_.LOGO as LOGO0_, ppo1_.CREATE_DATE as CREATE_23_0_, ppo1_.UPDATE_DATE as UPDATE_24_0_,
x0_.ID as ID1_, x0_.PPO_ID as PPO_ID1_, x0_.DOMAIN_ID as DOMAIN_ID1_, x0_.FIRSTNAME as FIRSTNAME1_,
x0_.MIDDLENAME as MIDDLENAME1_, x0_.LASTNAME as LASTNAME1_, x0_.GENDER as GENDER1_,
x0_.DATE_OF_BIRTH as DATE_OF_8_1_, x0_.ZIPCODE_HOME as ZIPCODE_9_1_, x0_.ZIPCODE_WORK as ZIPCODE10_1_,
x0_.EDUCATION as EDUCATION1_, x0_.MARITAL_STATUS as MARITAL12_1_, x0_.IS_ACCEPTED as IS_ACCE13_1_,
x0_.HAS_PROFILE as HAS_PRO14_1_, x0_.IS_ACTIVE as IS_ACTIVE1_, x0_.PROFILE as PROFILE1_,
x0_.CREATE_DATE as CREATE_17_1_, x0_.UPDATE_DATE as UPDATE_18_1_
from
DOMAIN this left outer join PPO ppo1_ on this.PPO_ID=ppo1_.ID inner join
WORKMATE x0_ on this.ID=x0_.DOMAIN_ID
where this.PPO_ID=?


Debug level Hibernate log excerpt:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.