Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle query help 36 82
Oracle RAC 12c 8 51
Oracle -- identify blocking session 24 41
Oracle - SQL Where clause causing Invalid Number Error 4 25
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
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…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

947 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

20 Experts available now in Live!

Get 1:1 Help Now