Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HHow to pass a Map type to a Clob?

 
chaohua wang
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic