-->
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.  [ 5 posts ] 
Author Message
 Post subject: what's wrong with this expression!??
PostPosted: Fri Sep 09, 2005 5:52 am 
Newbie

Joined: Tue Sep 06, 2005 9:50 am
Posts: 13
Now I stepped over to sqlQuery since criteria didn't work.
When I change "%" in to "'%'" during debug the code runs through en I get a result.
Second run the code throws an error. When I change back to "%" the code runs through again. Second run it again trows error.
Is this a bug in hibernate? or am I just running a code that that is out of reach for hibernate?

Hibernate version:
2.1.8
Mapping documents:
Look at topic JDBC Exception
Code between sessionFactory.openSession() and session.close():
Code:
Query q = session.createSQLQuery("select {this.*}, DOMAIN.NAME from WORKMATE {this} inner join DOMAIN on {this}.DOMAIN_ID = DOMAIN.ID " +
               "where " +
               "{this}.LASTNAME like :lastname and " +
               "{this}.FIRSTNAME like :firstname and " +
               "{this}.IS_ACTIVE like :isActive and " +
               "{this}.PPO_ID = :ppoId and " +
               "{this}.DOMAIN_ID like :domainId"
               , "this", Workmate.class);
         
         q.setString("ppoId", workmate.getPpoId().toString());         
         q.setString("lastname", "%");
         q.setString("firstname", "%");
         q.setString("isActive", "%");
         q.setString("domainId", "%");

Full stack trace of any exception that occurs:
[11:45:38,406] WARN JDBCExceptionReporter:57 - SQL Error: 1401, SQLState: 23000

[11:45:38,406] ERROR JDBCExceptionReporter:58 - ORA-01401: inserted value too large for column

[11:45:38,406] WARN JDBCExceptionReporter:57 - SQL Error: 1401, SQLState: 23000

[11:45:38,406] ERROR JDBCExceptionReporter:58 - ORA-01401: inserted value too large for column

[11:45:38,421] WARN JDBCExceptionReporter:57 - SQL Error: 1401, SQLState: 23000

[11:45:38,421] ERROR JDBCExceptionReporter:58 - ORA-01401: inserted value too large for column

[11:45:38,421] WARN JDBCExceptionReporter:57 - SQL Error: 1401, SQLState: 23000

[11:45:38,437] ERROR JDBCExceptionReporter:58 - ORA-01401: inserted value too large for column

[11:45:38,437] ERROR SessionImpl:2400 - Could not synchronize database state with session

Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
Hibernate: update WORKMATE set PPO_ID=?, DOMAIN_ID=?, FIRSTNAME=?, MIDDLENAME=?,
LASTNAME=?, GENDER=?, DATE_OF_BIRTH=?, ZIPCODE_HOME=?, ZIPCODE_WORK=?, EDUCATIO
N=?, MARITAL_STATUS=?, IS_ACCEPTED=?, HAS_PROFILE=?, IS_ACTIVE=?, PROFILE=?, CRE
ATE_DATE=?, UPDATE_DATE=? where ID=?

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 09, 2005 6:07 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
this is oracle error - you have any column with less length than string
for example, you have LASTNAME varchar2(5) and insert string '123456'

regards


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 09, 2005 8:52 am 
Newbie

Joined: Tue Sep 06, 2005 9:50 am
Posts: 13
The funny thing is, the code works when I execute it from a testclass (JUnit).
But when I run it from the business delegate (giving the same argument value as in test class), I get the same error.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 09, 2005 9:51 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
try junit test with parameter length > length column in database (or form oracle sql) and you get this error
double check value in business delegate (all values before update to database)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 10, 2005 12:33 pm 
Newbie

Joined: Tue Sep 06, 2005 9:50 am
Posts: 13
I have localized the problem.
In the action class I use the delegate to collect data with hibernate form the db.
I fill 3 lists with data gathered from db. (3 db operations)
2 lists are very similar, they connect to the same table (workmate). When I comment out one of the operations (doesn't matter which one), I don't get no errors anymore.
As you see in the generated SQL, hibernate tries an update! instead of select when both operations a uncommented.
This also happened with the Critera, the Query and the SQLQuery.


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

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.