-->
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.  [ 1 post ] 
Author Message
 Post subject: How to map ORACLE LONG through Hibernate mapping
PostPosted: Thu Sep 21, 2006 5:18 am 
Newbie

Joined: Thu Sep 21, 2006 4:54 am
Posts: 2
Location: India
Hibernate version: 2.0

Mapping documents:

<hibernate-mapping package="es.tao.framework.data.organization">
<class name="DUser" table="USERBW" >
<id name="dboid" column="DBOID">
<generator class="assigned"/>
</id>
<version name="dbts" column="DBTS" type="long"/>
<property name="userId" column="USERID" type="string"/>
<property name="userPwd" column="USERPWD" type="string"/>
<property name="lastLogin" column="LASTLOGIN" />
<property name="lastLogout" column="LASTLOGOUT" />

<many-to-one name="actor" column="ACTOR" class="es.tao.framework.data.organization.DActor"/>
<property name="userPwdFwk" column="USERPWDFWK" type="string"/>
<property name="lastPwdChange" column="LASTPWDCHANGE" />

<property name="pwNeverExpires" column="PWNEVEREXPIRES" type="boolean"/>
<property name="cannotChngPwd" column="CANNOTCHNGPWD" type="boolean"/>
<property name="mustChngPwd" column="MUSTCHNGPWD" type="boolean"/>
<property name="disabled" column="DISABLED" type="boolean"/>
<property name="logonTries" column="LOGONTRIES" type="int"/>
<property name="inActiveId" column="INACTIVEID" type="string"/>
<property name="active" column="ACTIVE" type="string"/>

<property name="certSubject" column="CERT_SUBJECT" type="string"/>
<property name="certIssuer" column="CERT_ISSUER" type="string"/>
<property name="certSerial" column="CERT_SERIAL" type="string"/>

<property name="osUser" column="OSUSER" type="string"/>



<property name="person" column="PERSON" type="string"/>

<property name="certRawData" type="text">
<column name="CERT_RAWDATA" sql-type="LONG" />
</property>

</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():


Transaction t = session.beginTransaction();
user = (DUser) dbSession.getSessionInfo().getSession().get(DUser.class,dboid);
user.setCertRawData("aa");
t.commit();
dbSession.endTransaction(t);



Full stack trace of any exception that occurs:

java.lang.Exception: could not load: [es.tao.framework.data.organization.DUser#500000006990799999]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at es.gedasgrp.framework.common.exception.Jdk13or14Exception.<init>(Jdk13or14Exception.java:85)
at es.gedasgrp.framework.common.exception.FrameworkException.<init>(FrameworkException.java:176)
at es.tao.framework.common.exception.TaoFrameworkException.<init>(TaoFrameworkException.java:124)
at es.tao.framework.common.exception.TaoDataAccessException.<init>(TaoDataAccessException.java:111)
at es.tao.framework.db.HibernateException.<init>(HibernateException.java:54)
at es.tao.framework.db.JDBCException.<init>(JDBCException.java:48)
at es.tao.framework.db.OracleJDBCExceptionTranslator.translateJDBCException(OracleJDBCExceptionTranslator.java:103)
at es.tao.framework.db.HibernateExceptionTranslator.translateJDBCException(HibernateExceptionTranslator.java:262)
at es.tao.framework.db.HibernateExceptionTranslator.translate(HibernateExceptionTranslator.java:227)
at es.tao.framework.db.Session.get(Session.java:993)
at es.tao.commonservices.test.junit.organization.TestMRole.testUser(TestMRole.java:146)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: net.sf.hibernate.JDBCException: could not load: [es.tao.framework.data.organization.DUser#500000006990799999]
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:429)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2144)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2018)
at net.sf.hibernate.impl.SessionImpl.get(SessionImpl.java:1954)
at es.tao.framework.db.Session.get(Session.java:991)
... 16 more
Caused by: java.sql.SQLException: Stream has already been closed
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:226)
at oracle.jdbc.driver.LongAccessor.getCharacterStream(LongAccessor.java:345)
at oracle.jdbc.driver.OracleResultSetImpl.getCharacterStream(OracleResultSetImpl.java:1464)
at oracle.jdbc.driver.OracleResultSet.getCharacterStream(OracleResultSet.java:2048)
at net.sf.hibernate.type.TextType.get(TextType.java:29)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:66)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:613)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:554)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:513)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:428)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:211)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:135)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:838)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:858)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:426)
... 20 more



Name and version of the database you are using: Oracle 9i

The generated SQL (show_sql=true):

Hibernate: select duser0_.DBOID as DBOID10_, duser0_.DBTS as DBTS10_, duser0_.USERID as USERID10_, duser0_.USERPWD as USERPWD10_, duser0_.LASTLOGIN as LASTLOGIN10_, duser0_.LASTLOGOUT as LASTLOGOUT10_, duser0_.ACTOR as ACTOR10_, duser0_.USERPWDFWK as USERPWDFWK10_, duser0_.LASTPWDCHANGE as LASTPWDC9_10_, duser0_.PWNEVEREXPIRES as PWNEVER10_10_, duser0_.CANNOTCHNGPWD as CANNOTC11_10_, duser0_.MUSTCHNGPWD as MUSTCHN12_10_, duser0_.DISABLED as DISABLED10_, duser0_.LOGONTRIES as LOGONTRIES10_, duser0_.INACTIVEID as INACTIVEID10_, duser0_.ACTIVE as ACTIVE10_, duser0_.CERT_SUBJECT as CERT_SU17_10_, duser0_.CERT_ISSUER as CERT_IS18_10_, duser0_.CERT_SERIAL as CERT_SE19_10_, duser0_.OSUSER as OSUSER10_, duser0_.PERSON as PERSON10_, duser0_.CERT_RAWDATA as CERT_RA22_10_, dactor1_.DBOID as DBOID0_, dactor1_.ACTORCODE as ACTORCODE157_0_, dactor1_.IDIOM as IDIOM157_0_, dactor1_.NAME as NAME157_0_, dactor1_.FAMILYNAME as FAMILYNAME157_0_, dactor1_.SECONDNAME as SECONDNAME157_0_, dactor1_.IDNUMBER as IDNUMBER157_0_, dactor1_.CTRLDIGIT as CTRLDIGIT157_0_, dactor1_.VATACRONYM as VATACRONYM157_0_, dactor1_.FULLNAME as FULLNAME157_0_, dactor1_.ROLESTS as ROLESTS157_0_, dactor1_.MAINROLE as MAINROLE157_0_, dactor1_.DEFROLE as DEFROLE157_0_, dactor1_.PARTY as PARTY157_0_, dactor1_.PERSON as PERSON157_0_, dactor1_.BELONGSTO as BELONGSTO157_0_, dactor1_.ACTIVE as ACTIVE157_0_, dactor1_.INACTIVEID as INACTIVEID157_0_, dactor1_.HOMEPHONE as HOMEPHONE157_0_, dactor1_.BUSINESSPHONE as BUSINES20_157_0_, dactor1_.MOBILEPHONE as MOBILEP21_157_0_, dactor1_.OTHERPHONE as OTHERPHONE157_0_, dactor1_.HOMEFAX as HOMEFAX157_0_, dactor1_.BUSINESSFAX as BUSINES24_157_0_, dactor1_.HOMEEMAIL as HOMEEMAIL157_0_, dactor1_.BUSINESSEMAIL as BUSINES26_157_0_, dactor1_.TITLE as TITLE157_0_, dactor1__1_.DBTS as DBTS142_0_, dactor1__1_.INSTS as INSTS142_0_, dactor1__1_.INSUSER as INSUSER142_0_, dactor1__1_.INSROLE as INSROLE142_0_, dactor1__1_.LASTTS as LASTTS142_0_, dactor1__1_.LASTUSER as LASTUSER142_0_, dactor1__1_.LASTROLE as LASTROLE142_0_, drole2_.DBOID as DBOID1_, drole2_.ROLECODE as ROLECODE154_1_, drole2_.GROUPING as GROUPING154_1_, drole2_.HOLDER as HOLDER154_1_, drole2_.ACTIVE as ACTIVE154_1_, drole2_.INACTIVEID as INACTIVEID154_1_, drole2_.NAME as NAME154_1_, drole2__1_.DBTS as DBTS142_1_, drole2__1_.INSTS as INSTS142_1_, drole2__1_.INSUSER as INSUSER142_1_, drole2__1_.INSROLE as INSROLE142_1_, drole2__1_.LASTTS as LASTTS142_1_, drole2__1_.LASTUSER as LASTUSER142_1_, drole2__1_.LASTROLE as LASTROLE142_1_, dgrouping3_.DBOID as DBOID2_, case when dgrouping3__2_.DBOID is not null then 1 when dgrouping3_.DBOID is not null then 0 end as clazz_2_, dgrouping3_.GROUPCODE as GROUPCODE144_2_, dgrouping3_.VALSTART as VALSTART144_2_, dgrouping3_.VALEND as VALEND144_2_, dgrouping3_.CHILDRENDBTS as CHILDREN5_144_2_, dgrouping3_.ROLESTS as ROLESTS144_2_, dgrouping3_.PARTY as PARTY144_2_, dgrouping3_.INTERNAL as INTERNAL144_2_, dgrouping3_.ACTIVE as ACTIVE144_2_, dgrouping3_.PARENT as PARENT144_2_, dgrouping3_.ORGAN as ORGAN144_2_, dgrouping3_.CATEGORY as CATEGORY144_2_, dgrouping3_.TYPEID as TYPEID144_2_, dgrouping3_.MEMBERSTS as MEMBERSTS144_2_, dgrouping3_.INACTIVEID as INACTIVEID144_2_, dgrouping3_.NAME as NAME144_2_, dgrouping3_.FULLNAME as FULLNAME144_2_, dgrouping3__1_.DBTS as DBTS142_2_, dgrouping3__1_.INSTS as INSTS142_2_, dgrouping3__1_.INSUSER as INSUSER142_2_, dgrouping3__1_.INSROLE as INSROLE142_2_, dgrouping3__1_.LASTTS as LASTTS142_2_, dgrouping3__1_.LASTUSER as LASTUSER142_2_, dgrouping3__1_.LASTROLE as LASTROLE142_2_, dgrouping3__2_.GROUPINGSTS as GROUPING2_147_2_, dgrouping4_.DBOID as DBOID3_, case when dgrouping4__2_.DBOID is not null then 1 when dgrouping4_.DBOID is not null then 0 end as clazz_3_, dgrouping4_.GROUPCODE as GROUPCODE144_3_, dgrouping4_.VALSTART as VALSTART144_3_, dgrouping4_.VALEND as VALEND144_3_, dgrouping4_.CHILDRENDBTS as CHILDREN5_144_3_, dgrouping4_.ROLESTS as ROLESTS144_3_, dgrouping4_.PARTY as PARTY144_3_, dgrouping4_.INTERNAL as INTERNAL144_3_, dgrouping4_.ACTIVE as ACTIVE144_3_, dgrouping4_.PARENT as PARENT144_3_, dgrouping4_.ORGAN as ORGAN144_3_, dgrouping4_.CATEGORY as CATEGORY144_3_, dgrouping4_.TYPEID as TYPEID144_3_, dgrouping4_.MEMBERSTS as MEMBERSTS144_3_, dgrouping4_.INACTIVEID as INACTIVEID144_3_, dgrouping4_.NAME as NAME144_3_, dgrouping4_.FULLNAME as FULLNAME144_3_, dgrouping4__1_.DBTS as DBTS142_3_, dgrouping4__1_.INSTS as INSTS142_3_, dgrouping4__1_.INSUSER as INSUSER142_3_, dgrouping4__1_.INSROLE as INSROLE142_3_, dgrouping4__1_.LASTTS as LASTTS142_3_, dgrouping4__1_.LASTUSER as LASTUSER142_3_, dgrouping4__1_.LASTROLE as LASTROLE142_3_, dgrouping4__2_.GROUPINGSTS as GROUPING2_147_3_, dorganizat5_.DBOID as DBOID4_, dorganizat5_.GROUPINGSTS as GROUPING2_147_4_, dorganizat5__1_.GROUPCODE as GROUPCODE144_4_, dorganizat5__1_.VALSTART as VALSTART144_4_, dorganizat5__1_.VALEND as VALEND144_4_, dorganizat5__1_.CHILDRENDBTS as CHILDREN5_144_4_, dorganizat5__1_.ROLESTS as ROLESTS144_4_, dorganizat5__1_.PARTY as PARTY144_4_, dorganizat5__1_.INTERNAL as INTERNAL144_4_, dorganizat5__1_.ACTIVE as ACTIVE144_4_, dorganizat5__1_.PARENT as PARENT144_4_, dorganizat5__1_.ORGAN as ORGAN144_4_, dorganizat5__1_.CATEGORY as CATEGORY144_4_, dorganizat5__1_.TYPEID as TYPEID144_4_, dorganizat5__1_.MEMBERSTS as MEMBERSTS144_4_, dorganizat5__1_.INACTIVEID as INACTIVEID144_4_, dorganizat5__1_.NAME as NAME144_4_, dorganizat5__1_.FULLNAME as FULLNAME144_4_, dorganizat5__2_.DBTS as DBTS142_4_, dorganizat5__2_.INSTS as INSTS142_4_, dorganizat5__2_.INSUSER as INSUSER142_4_, dorganizat5__2_.INSROLE as INSROLE142_4_, dorganizat5__2_.LASTTS as LASTTS142_4_, dorganizat5__2_.LASTUSER as LASTUSER142_4_, dorganizat5__2_.LASTROLE as LASTROLE142_4_, dorganizat6_.DBOID as DBOID5_, dorganizat6_.GROUPINGSTS as GROUPING2_147_5_, dorganizat6__1_.GROUPCODE as GROUPCODE144_5_, dorganizat6__1_.VALSTART as VALSTART144_5_, dorganizat6__1_.VALEND as VALEND144_5_, dorganizat6__1_.CHILDRENDBTS as CHILDREN5_144_5_, dorganizat6__1_.ROLESTS as ROLESTS144_5_, dorganizat6__1_.PARTY as PARTY144_5_, dorganizat6__1_.INTERNAL as INTERNAL144_5_, dorganizat6__1_.ACTIVE as ACTIVE144_5_, dorganizat6__1_.PARENT as PARENT144_5_, dorganizat6__1_.ORGAN as ORGAN144_5_, dorganizat6__1_.CATEGORY as CATEGORY144_5_, dorganizat6__1_.TYPEID as TYPEID144_5_, dorganizat6__1_.MEMBERSTS as MEMBERSTS144_5_, dorganizat6__1_.INACTIVEID as INACTIVEID144_5_, dorganizat6__1_.NAME as NAME144_5_, dorganizat6__1_.FULLNAME as FULLNAME144_5_, dorganizat6__2_.DBTS as DBTS142_5_, dorganizat6__2_.INSTS as INSTS142_5_, dorganizat6__2_.INSUSER as INSUSER142_5_, dorganizat6__2_.INSROLE as INSROLE142_5_, dorganizat6__2_.LASTTS as LASTTS142_5_, dorganizat6__2_.LASTUSER as LASTUSER142_5_, dorganizat6__2_.LASTROLE as LASTROLE142_5_, dgroupingc7_.DBOID as DBOID6_, dgroupingc7_.CATEGORYCODE as CATEGORY2_6_, dgroupingc8_.DBOID as DBOID7_, dgroupingc8_.CATEGORYCODE as CATEGORY2_7_, dgroupingc9_.DBOID as DBOID8_, dgroupingc9_.CATEGORYCODE as CATEGORY2_8_, dgroupingc10_.DBOID as DBOID9_, dgroupingc10_.CATEGORYCODE as CATEGORY2_9_ from USERBW duser0_ left outer join ACTOR dactor1_ on duser0_.ACTOR=dactor1_.DBOID left outer join STAMPED dactor1__1_ on dactor1_.DBOID=dactor1__1_.DBOID left outer join ROLEBW drole2_ on dactor1_.MAINROLE=drole2_.DBOID left outer join STAMPED drole2__1_ on drole2_.DBOID=drole2__1_.DBOID left outer join GROUPING dgrouping3_ on drole2_.GROUPING=dgrouping3_.DBOID left outer join STAMPED dgrouping3__1_ on dgrouping3_.DBOID=dgrouping3__1_.DBOID left outer join ORGANIZA dgrouping3__2_ on dgrouping3_.DBOID=dgrouping3__2_.DBOID left outer join GROUPING dgrouping4_ on dgrouping3_.PARENT=dgrouping4_.DBOID left outer join STAMPED dgrouping4__1_ on dgrouping4_.DBOID=dgrouping4__1_.DBOID left outer join ORGANIZA dgrouping4__2_ on dgrouping4_.DBOID=dgrouping4__2_.DBOID left outer join ORGANIZA dorganizat5_ on dgrouping4_.ORGAN=dorganizat5_.DBOID left outer join GROUPING dorganizat5__1_ on dorganizat5_.DBOID=dorganizat5__1_.DBOID left outer join STAMPED dorganizat5__2_ on dorganizat5_.DBOID=dorganizat5__2_.DBOID left outer join ORGANIZA dorganizat6_ on dorganizat5__1_.ORGAN=dorganizat6_.DBOID left outer join GROUPING dorganizat6__1_ on dorganizat6_.DBOID=dorganizat6__1_.DBOID left outer join STAMPED dorganizat6__2_ on dorganizat6_.DBOID=dorganizat6__2_.DBOID left outer join FWK_GROUPINGCATEGORY dgroupingc7_ on dorganizat6__1_.CATEGORY=dgroupingc7_.DBOID left outer join FWK_GROUPINGCATEGORY dgroupingc8_ on dorganizat5__1_.CATEGORY=dgroupingc8_.DBOID left outer join FWK_GROUPINGCATEGORY dgroupingc9_ on dgrouping4_.CATEGORY=dgroupingc9_.DBOID left outer join FWK_GROUPINGCATEGORY dgroupingc10_ on dgrouping3_.CATEGORY=dgroupingc10_.DBOID where duser0_.DBOID=?



Debug level Hibernate log excerpt:




Quote:
I'm using String for the property of Oracle LONG in my POJO class.When there is no data for that particular column, my object is loaded. But once i store some data and then again try to load the Object. Hibernate gives me a SQLException stating that the 'Stream has already been closed'


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

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.