Solved

larege String(more than 4k) to CLOB conversion using hibernate

Posted on 2009-03-30
8
2,611 Views
Last Modified: 2012-06-27
Hi ,
 i have a java class persisting a large string(>4k) into a DB table into a CLOB field.
if the string is less in siz(<4k) im not any facing problems, its working fine.

i read somewhere to use the type="text" in the hbm file so kept that which gave a exception for batching not support for streams. so made the batch size to 0. which is giving the exception:

Caused by: java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested

      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
      at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
      at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
      at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
      at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1144)
      at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2152)
      at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2035)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2876)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
      at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2062)
      ... 36 more
0
Comment
Question by:bhupal_artha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 15

Assisted Solution

by:Franck Pachot
Franck Pachot earned 40 total points
ID: 24022982
Hi,;
Can you show the sql generated by hibernate (with show_sql=true)
Thanks,
Franck.
0
 
LVL 17

Assisted Solution

by:Thomas4019
Thomas4019 earned 20 total points
ID: 24024583
Could the split you string into two with substring, then store it in the database, then concat them back together again.
0
 

Author Comment

by:bhupal_artha
ID: 24026028
thanks for a quick reply guyz..
@franckpachot sql generated by hibernate:

Hibernate: select CCAD_ERROR_SEQ.nextval from dual
Hibernate: insert into CCAD_ERRORS (REQUEST_ID, ERROR_DATE, ERROR_CODE, ERROR_TEXT, REQUEST_XML, ERROR_ID) values (?, ?, ?, ?, ?, ?)
- SQL Error: 1460, SQLState: 72000

@Thomas4019
that can be done thomas it like a long way around im trying for a simple and quick fix...
my doubt id that oracle will allow to store large data(like upto GBs) into CLOBs but y is it not letting the
String (which is very small around 5-10k) to go into a CLOB?? any options to set..?? or do we need to change the string to clob object before persisting it into DB??
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:bhupal_artha
ID: 24026042
@franckpachot  here the CLOB is going into REQUEST_XML field...
0
 

Author Comment

by:bhupal_artha
ID: 24027166
if somebody have any idea to persist String field types in java to CLOBs in oracle please share ur experiences here.
0
 
LVL 15

Assisted Solution

by:Franck Pachot
Franck Pachot earned 40 total points
ID: 24027830
Hi,

I think that type="text" does not use the jdbc java.sql.Clob but java.lang.String.

Can you try with type="clob" (and you java attribute should be of type java.sql.Clob)

Regards,
Franck.
0
 

Accepted Solution

by:
bhupal_artha earned 0 total points
ID: 24028149
than q very for ur help guyz.  i thik i figured out the prob of converting the string to clob conversion.

I have updated the ojdbc14.jar and hopefully got my problem fixed.

any updates ill keep posting.
0
 

Author Comment

by:bhupal_artha
ID: 24028174
thakq very much all.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question