-->
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.  [ 11 posts ] 
Author Message
 Post subject: Question about inserting a "CLOB" ????????????
PostPosted: Wed Dec 17, 2003 4:01 am 
Beginner
Beginner

Joined: Thu Sep 04, 2003 2:52 am
Posts: 29
HI,
I have a bean which has a "java.sql.Clob" property,I have read the howto about using clob with hibernate. my code is like this:

bean.setContent(Hibernate.createClob(aString));

session.save(bean);
session.comit();

but when run to session.commit(),the process stopped with no exceptions.
Just stopped there. So I opened hibernate debug mode,then I get this:

--------------------------------
Hibernate: insert into TBL_FIREWALL_CONFIG (element_id, param_id, used, version, content, insert_time, ID) values (?, ?, ?, ?, ?, ?, ?)

15:58:15,637 DEBUG IntegerType:44 - binding '372' to parameter: 1

15:58:15,637 DEBUG IntegerType:38 - binding null to parameter: 2

15:58:15,637 DEBUG BooleanType:44 - binding 'true' to parameter: 3

15:58:15,637 DEBUG StringType:44 - binding 'v1.0' to parameter: 4

15:58:15,657 DEBUG ClobType:44 - binding 'net.sf.hibernate.lob.ClobImpl@d2b918' to parameter: 5

15:58:15,657 DEBUG LongType:44 - binding '1071647895617' to parameter: 6

15:58:15,657 DEBUG LongType:44 - binding '109' to parameter: 7

tell me why ,thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 4:34 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
There is no Session.commit(). What does your code really look like?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 4:41 am 
Beginner
Beginner

Joined: Thu Sep 04, 2003 2:52 am
Posts: 29
Hi,gavin,
I am sorry for my mistake.
My code is like this:

s = HibernateSessionFactory.openSession();
tx = s.beginTransaction();
s.save(bean);
tx.commit();// here stopped

when I trace into the process,then I found stop here:

executeAll( insertions.iterator() );//stop here
executeAll( updates.values().iterator() );
executeAll( collectionRemovals.iterator() );
executeAll( collectionUpdates.iterator() );
executeAll( collectionCreations.iterator() );
executeAll( deletions.iterator() );

Then after a "long" time ,I get an exception like this:
---------------------------------------------------------------
net.sf.hibernate.JDBCException: Could not synchronize database state with session at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2081) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2017) at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:57) at com.lianchuang.smartsecurer.topo.firewall.dao.FirewallConfigDBUtil.insertFirewallConfigBean(FirewallConfigDBUtil.java:29) at com.lianchuang.smartsecurer.topo.firewall.dao.FirewallConfigDBUtil.main(FirewallConfigDBUtil.java:65) Caused by: java.sql.SQLException: ORA-00600: 内部错误代码,自变量: [kokleva], [], [], [], [], [], [], []
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 4:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
And what is ORA-00600 according to your Oracle doco?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 4:54 am 
Beginner
Beginner

Joined: Thu Sep 04, 2003 2:52 am
Posts: 29
I have google for ORA-00600,But I found that there is no solution for
this situation. It seems that it error is related to oracle jdbc driver. My
oracle is 8.1.7 .I don't know how to deal with this problem. Can you help me gavin?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 4:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I am not an Oracle expert, and I've rarely used LOBs in real life.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 5:04 am 
Beginner
Beginner

Joined: Thu Sep 04, 2003 2:52 am
Posts: 29
me too.
I use clob in oracle ,just because my data is greater than 4k,I can't use
varchar datatypes. So,I have to deal with this .So frustrated.
gavin,I know you are the expert in hibernate.please help me of this problem,this is my christmas wish.:-)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 5:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Perhaps someone else can help. Seriously, this kind of problem is almost impossible to resolve without being physically present.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 5:38 am 
Newbie

Joined: Sun Sep 14, 2003 8:42 pm
Posts: 3
read the article
http://www.hibernate.org/56.html

_________________
i like Hibernate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 5:54 am 
Beginner
Beginner

Joined: Thu Sep 04, 2003 2:52 am
Posts: 29
thanks,I have read all articals about this topic in hibernate.org

and I found that if I reduce the size of data ,then the insertion would
be successful.or would get exception.I found that the exception is raised
in oracle jdbc driver.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 18, 2003 2:27 am 
Newbie

Joined: Sun Sep 14, 2003 8:42 pm
Posts: 3
I have successfully inserted clob>4k into oracle8.1.7

You should do like this:

bean.setContent(Hibernate.createClob(" "));
session.save(bean);
session.comit();
session.flush;
session.refresh(bean,LockMode.UPGRADE);
oracle.sql.CLOB clobs = (oracle.sql.CLOB) bean.getContent();
java.io.Writer pw = clobs.getCharacterOutputStream();
pw.write(aString);
pw.close();

tx.commit();

_________________
i like Hibernate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 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.