-->
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.  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Fri Mar 23, 2007 4:24 pm 
Newbie

Joined: Tue Feb 13, 2007 1:31 pm
Posts: 5
Here is the TypeDefs.hbm.xml file

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<typedef class="org.hibernate.type.StringClobType" name="stringClobType"/>
</hibernate-mapping>


Define the the property in the following way in hibernate mapping file for your entity/domain

<property name="xxx" type="stringClobType">
<column name="MESSAGE_CONTENT" not-null="true">
<comment>XXXXYYYY</comment>
</column>
</property>


Dont forget to add an entry for TypeDefs.hbm.xml in your hibernate context file.

Manish


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 10:53 am 
Newbie

Joined: Mon Mar 19, 2007 5:28 pm
Posts: 6
Manish,

For some reason, I don't have the StringClobType.class in my hibernate-3.2.2.ga.jar. Could you please let me know which Hibernate jar has this class.

Thanks
-Sallini


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 12:40 pm 
Newbie

Joined: Tue Feb 13, 2007 1:31 pm
Posts: 5
You need to have the hibernate annotations jar for that.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 2:31 pm 
Newbie

Joined: Mon Mar 19, 2007 5:28 pm
Posts: 6
Manish,

I am getting this exception after adding hibernate-annotations.jar file.

2007-03-26 13:25:53,017 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: null
2007-03-26 13:25:53,017 [main] ERROR org.hibernate.util.JDBCExceptionReporter - ORA-24801: illegal parameter value in OCI lob function

2007-03-26 13:25:53,042 [main] INFO org.hibernate.event.def.DefaultLoadEventListener - Error performing load command
org.hibernate.exception.GenericJDBCException: could not load an entity: [com.fxfn.misp.dto.SQLReportTO#FX.CheckRegisterFeeItemCreator]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1865)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3038)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:179)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at org.springframework.orm.hibernate3.HibernateTemplate$1.doInHibernate(HibernateTemplate.java:465)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:459)
at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:453)
at com.fxfn.misp.dao.hibernate.HibernateSQLReportDAO.find(HibernateSQLReportDAO.java:27)
at com.fxfn.newgen.test.HibernateDbApp.main(HibernateDbApp.java:100)
Caused by: java.sql.SQLException: ORA-24801: illegal parameter value in OCI lob function

at org.hibernate.type.StringClobType.nullSafeGet(StringClobType.java:49)
at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2092)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1371)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1299)
at org.hibernate.loader.Loader.getRow(Loader.java:1197)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:568)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1851)
... 17 more


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 26, 2007 8:12 pm 
Newbie

Joined: Tue Feb 13, 2007 1:31 pm
Posts: 5
Not sure what could be wrong with this, probably needs some more research.

Sorry i do not have any information available about this error or what could cause this error. (a jar version?)

Will let you know if i find something. but it's less likely that i will reply soon since i am lil busy this week.

Although, just to let you know that we have following jars in our project.

hibernate-annotations.jar
hibernate-entitymanager.jar
persistence.jar
c3p0-0.9.0.4.jar

you can try adding any missing jars and see if it works

Good luck

Manish


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 27, 2007 1:55 pm 
Newbie

Joined: Mon Mar 19, 2007 5:28 pm
Posts: 6
Thanks Manish for your time. I added the persistence.jar and c3p0-0.9.0.4.jar to my classpath, but did not help.... May be I should try changing the 9i drivers to 10g drivers and see if that works.

Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 11, 2008 12:35 pm 
Newbie

Joined: Thu May 18, 2006 1:46 pm
Posts: 10
Hello there! I'm facing the clob 4000 chars problem here :(

I'm using the StringClobType in my class, but still oracle complains about the limit of the column.

Any ideas?

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 30, 2008 11:51 am 
Newbie

Joined: Fri May 30, 2008 11:47 am
Posts: 1
Hello Manish, please tell me the version of oracle do you use is 9i?
How do you mapping Typedefs.xml?
Please.
Esperanza
Thanks you

manishbel wrote:
Why are you still applying the custom solution?

Hibernate (3.0?) provides org.hibernate.type.StringClobType that you can use for String to Clob and vice-a-versa conversion.

Add following entry to Typedefs.xml

<typedef class="org.hibernate.type.StringClobType" name="stringClobType"/>

and define this custom type in your hibernate mapping files for any string property that you want to be stored as CLOB.

I ran a Unit Test and tried to store more than 4000 characters for the property defined as stringClobType and it worked just fine.

Manish


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

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.