aspose file tools*
The moose likes Java in General and the fly likes HHow to pass a Map type to a Clob? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "HHow to pass a Map type to a Clob?" Watch "HHow to pass a Map type to a Clob?" New topic
Author

HHow to pass a Map type to a Clob?

chaohua wang
Ranch Hand

Joined: Dec 22, 2002
Posts: 62
hi, folks,

I have a POJO object (hibernate).

import java.sql.Clob;

public void setResults(Clob results) {
this.results = results;
}


but i have variable pro, which is Map type and has some values.

dataobject.setResults((Clob)pro);

it can complie. but when i run it,

I got an exception,
17:24:12,332 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
17:24:12,332 ERROR [STDERR] Caused by: javax.transaction.TransactionRolledbackException: java.util.HashMap cannot be cast to java.sql.Clob; nested exception is:
java.lang.ClassCastException: java.util.HashMap cannot be cast to java.sql.Clob

How can i fix this issue? there is any way to transform Hashmap to a Clob.
Please help, Thank you!

Chwang
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HHow to pass a Map type to a Clob?