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.  [ 3 posts ] 
Author Message
 Post subject: ClassCastException building SessionFactory with Oracle 10g
PostPosted: Wed Apr 16, 2008 4:08 am 
Newbie

Joined: Wed Apr 16, 2008 3:49 am
Posts: 4
Description

I'm executing a segment of Hibernate Code. When I'm triying to build de SessionFactory class, I obain the error below.

As you can see at the hibernate.cfg.xml, I have the next mapping class:

Code:
AacMemberType
AacComponentTypeOperation
AacMember
AacPermission
PubFila
AacComponentOperation
PubFilaItem
AacComponentType
AacMemberGroup //This is the last class analized before the error

//Error (resumed)
java.lang.ClassCastException: org.hibernate.type.StringType

//The next mapping class aren't analyzed and I don't know which the error is produced by it

[b]AacApplication
AacComponent
AacMemberUser
AacPermission
PubFilaDocumento
PubLista
PubListaCampo[/b]



All clases has theis own DAO functions.

Thank you!

Hibernate version:

Hibernate 3.1

Mapping documents:

hibernate.cfg.xml

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC " -//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.password">VGP</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@situla.cc.upv.es:1583:BIBDES</property>
        <property name="hibernate.connection.username">DESA_INTRABIB</property>
        <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
        <mapping resource="es/upv/bib/publicador/modelo/AacMemberType.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/AacComponentTypeOperation.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/AacMember.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/AacPermission.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/PubFila.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/AacComponentOperation.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/PubFilaItem.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/AacComponentType.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/AacMemberGroup.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/PubFilaDocumento.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/AacComponent.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/PubListaCampo.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/PubLista.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/AacMemberUser.hbm.xml" />
        <mapping resource="es/upv/bib/publicador/modelo/AacApplication.hbm.xml" />
    </session-factory>
</hibernate-configuration>


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

The error comes from next line

Code:
sessionFactory = new Configuration().configure().buildSessionFactory();


Full stack trace of any exception that occurs:

Code:
2844 [http-8080-2] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  - Static SQL for entity: es.upv.bib.publicador.modelo.AacMemberGroup
2844 [http-8080-2] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Version select: select ID_GROUP from DESA_INTRABIB.AAC_MEMBER_GROUP where ID_GROUP =?
2844 [http-8080-2] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Snapshot select: select aacmemberg_.ID_GROUP, aacmemberg_.NAME as NAME9_, aacmemberg_.EMAIL as EMAIL9_ from DESA_INTRABIB.AAC_MEMBER_GROUP aacmemberg_ where aacmemberg_.ID_GROUP=?
2844 [http-8080-2] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Insert 0: insert into DESA_INTRABIB.AAC_MEMBER_GROUP (NAME, EMAIL, ID_GROUP) values (?, ?, ?)
2844 [http-8080-2] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Update 0: update DESA_INTRABIB.AAC_MEMBER_GROUP set NAME=?, EMAIL=? where ID_GROUP=?
2844 [http-8080-2] DEBUG org.hibernate.persister.entity.AbstractEntityPersister  -  Delete 0: delete from DESA_INTRABIB.AAC_MEMBER_GROUP where ID_GROUP=?
2846 [http-8080-2] ERROR es.upv.bib.publicador.sesion.Sesion  - Error al iniciar la conexión a la BD
java.lang.ClassCastException: org.hibernate.type.StringType
   at org.hibernate.tuple.PropertyFactory.buildVersionProperty(PropertyFactory.java:84)
   at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:168)
   at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
   at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
   at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
   at es.upv.bib.publicador.sesion.Sesion.autentificacion(Sesion.java:272)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.el.parser.AstValue.invoke(AstValue.java:131)
   at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
   at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
   at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
   at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
   at javax.faces.component.UICommand.broadcast(UICommand.java:383)
   at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
   at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
   at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Unknown Source)


Name and version of the database you are using:

Oracle 10g

Classes


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 17, 2008 12:50 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Please post the contents of your AacMemberGroup.hbm.xml file and also the java class that you map to AacMemberGroup.

_________________
Sukirtha


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 18, 2008 4:27 am 
Newbie

Joined: Wed Apr 16, 2008 3:49 am
Posts: 4
Hi Sukirtha,

I was found the error. I generated the hbm files with the Eclipse Engine "Hibernate Tools".

Well, when I executed the reverse engineering, one of the columns from my table was named as "VERSION" then, the mapping file didn't build the lines:

Code:
<property name="version" type="string">
            <column name="VERSION" length="20" />
</property>


but generate the tag <version ...>...</version>

The solution is change the name column.

Thanks!!!


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