[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2009-03-30
8
Medium Priority
?
2,705 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
  • 5
  • 2
8 Comments
 
LVL 15

Assisted Solution

by:Franck Pachot
Franck Pachot earned 160 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 80 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
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 

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 160 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
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…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
Suggested Courses
Course of the Month20 days, 2 hours left to enroll

873 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