Solved

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

Posted on 2009-03-30
8
2,501 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 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
 

Author Comment

by:bhupal_artha
ID: 24026042
@franckpachot  here the CLOB is going into REQUEST_XML field...
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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
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

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now