Solved

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

Posted on 2009-03-30
8
2,581 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

726 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