These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to cast a Hashmap to a Clob?
PostPosted: Tue Apr 22, 2008 11:35 am 
Beginner
Beginner

Joined: Thu Jun 30, 2005 4:14 pm
Posts: 25
Hi, folks,

I have a hibernate POJO object, which has a method

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



but i have variable pro, which is Map type and has some values.
I need to pass this Hashmap value to this mehtod,
like this,
Code:
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 cast Hashmap to a Clob.
Please help, Thank you!

Chwang


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 22, 2008 5:28 pm 
Newbie

Joined: Thu Dec 15, 2005 8:31 am
Posts: 10
No you can't do that. At best you could serialize the HashMap into the clob using ObjectOutputStream


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.