-->
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.  [ 8 posts ] 
Author Message
 Post subject: HibernateException Thrown - could not load:
PostPosted: Tue Apr 27, 2004 10:52 am 
Newbie

Joined: Tue Apr 27, 2004 10:38 am
Posts: 4
Location: houston, tx
I'm getting a HibernateException while trying to query my oracle database for my DataIdentifierGroup object. I've tried using regular jdbc and i'm able to query this table. I've tried several access methods, session.find(), session.get(), session.createCriteria(DataIdentifierGroup.class).list() and nothing seems to be working. I'm not sure what i'm doing wrong.

Servlet Code:

try {

logger.info("Just About to call Hibernate Classes");

logger.info("Calling Configuration()");
Configuration conf = new Configuration();

logger.info("Calling configure()");
conf.configure();

logger.info("Calling buildSessionFactory()");
SessionFactory sf = conf.buildSessionFactory();

logger.info("Got Hibernate Session Factory");
logger.info("Opening Session");

Session session = sf.openSession();
logger.info("Got Sesssion From Session Factory");

Query query = session.createQuery("from DataIdentifierGroup");

logger.info("Performing Query");

Iterator it = query.iterate();

logger.info("Executed Query");

while(it.hasNext()) {

DataIdentifierGroup dataIdentifierGroup = DataIdentifierGroup) it.next();

out.println("<p><b>Group Id:</b> " + dataIdentifierGroup.getIdentifierGroupId());

}


} catch (HibernateException he) {

System.out.println("HibernateException Thrown - " + he.getMessage());
out.println("HibernateException Thrown - " + he.getMessage());

} catch (Exception e) {

System.out.println("Exception Thrown - " + e.toString());
out.println("Exception Thrown - " + e.toString());

}

hiberante.cfg.xml:

<hibernate-configuration>

<session-factory>

<!-- properties -->
<property name="hibernate.connection.datasource">java:comp/env/CITTPDEV</property>
<property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="show_sql">true</property>
<property name="hibernate.cache.provider_class">net.sf.hibernate.cache.OSCacheProvider</property>
<property name="hibernate.cache.use_query_cache">true</property>
<!-- mapping files -->
<mapping resource="DataIdentifierGroup.hbm.xml"/>
<mapping resource="DataIdentifier.hbm.xml"/>

</session-factory>

</hibernate-configuration>

DataIdentifierGroup.hbm.xml:

<hibernate-mapping package="com.jpmorganchase.gcrm.cment.caching.ORMO">

<class name="DataIdentifierGroup" table="CME_DATA_IDENTIFIER_GROUP" mutable="false">

<cache usage="read-only"/>

<!-- A 32 hex character is our surrogate key. It's automatically
generated by Hibernate with the UUID pattern. -->
<id name="identifierGroupId" type="java.math.BigDecimal" column="IDENTIFIER_GROUP_ID">
<generator class="assigned"/>
</id>

<property name="identifierGroupName" type="java.lang.String" column="IDENTIFIER_GROUP_NAME"/>
<property name="updateDate" type="java.sql.Timestamp" column="UPDATE_DATE"/>
<property name="updateUserId" type="java.math.BigDecimal" column="UPDATE_USER_ID"/>

</class>

</hibernate-mapping>

DataIdentifierGroup.java:

package com.jpmorganchase.gcrm.cment.caching.ORMO;

import java.math.BigDecimal;
import java.sql.Timestamp;

public class DataIdentifierGroup {

private BigDecimal identifierGroupId;
private String identifierGroupName;
private Timestamp updateDate;
private BigDecimal updateUserId;

public DataIdentifierGroup() {
}

public BigDecimal getIdentifierGroupId() {
return identifierGroupId;
}

public void setIdentifierGroupId(BigDecimal identifierGroupId) {
this.identifierGroupId = identifierGroupId;
}

public String getIdentifierGroupName() {
return identifierGroupName;
}

public void setIdentifierGroupName(String identifierGroupName) {
this.identifierGroupName = identifierGroupName;
}

public Timestamp getUpdateDate() {
return updateDate;
}

public void setUpdateDate(Timestamp updateDate) {
this.updateDate = updateDate;
}

public BigDecimal getUpdateUserId() {
return updateUserId;
}

public void setUpdateUserId(BigDecimal updateUserId) {
this.updateUserId = updateUserId;
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 11:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
And, for some reason, you decided that there was no reason to provide a stack trace?? Despite the explicit instructions in red??


C'mon people, quality of questions has deteriorated a great deal the past two weeks, please make a bit more effort! We provide very clear instructions about what we expect!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 11:43 am 
Newbie

Joined: Tue Apr 27, 2004 10:38 am
Posts: 4
Location: houston, tx
Sorry for not posting the stacktrace. Here it is and thanks for the help in advance.


Hibernate: select dataidenti0_.IDENTIFIER_GROUP_ID as x0_0_ from CME_DATA_IDENTIFIER_GROUP dataidenti0_
net.sf.hibernate.JDBCException: Could not execute query
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1580)
at net.sf.hibernate.impl.QueryImpl.iterate(QueryImpl.java:27)
at com.jpmorganchase.cment.servlet.CacheTestServlet.doGet(CacheTestServlet.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6310)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Caused by: java.sql.SQLException: Protocol violation
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:591)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1894)
at oracle.jdbc.ttc7.TTC7Protocol.executeFetch(TTC7Protocol.java:956)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2667)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2840)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:536)
at weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:80)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:795)
at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:848)
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1577)
... 14 more


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 11:47 am 
Newbie

Joined: Tue Apr 27, 2004 10:38 am
Posts: 4
Location: houston, tx
This is actually the correct stacktrace.


net.sf.hibernate.JDBCException: could not load: [com.jpmorganchase.cment.ormo.DataIdentifierGroup#8]
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:422)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2081)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1955)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1917)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:68)
at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:215)
at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:154)
at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:71)
at net.sf.hibernate.impl.IteratorImpl.<init>(IteratorImpl.java:48)
at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:849)
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1577)
at net.sf.hibernate.impl.QueryImpl.iterate(QueryImpl.java:27)
at com.jpmorganchase.cment.servlet.CacheTestServlet.doGet(CacheTestServlet.java:109)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6310)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Caused by: java.sql.SQLException: Bigger type length than Maximum
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:1160)
at oracle.jdbc.ttc7.MAREngine.buffer2Value(MAREngine.java:2753)
at oracle.jdbc.ttc7.MAREngine.unmarshalUB4(MAREngine.java:1290)
at oracle.jdbc.ttc7.MAREngine.unmarshalSB4(MAREngine.java:1256)
at oracle.jdbc.ttc7.TTIoac.unmarshal(TTIoac.java:157)
at oracle.jdbc.ttc7.v8TTIoac.unmarshal(v8TTIoac.java:148)
at oracle.jdbc.ttc7.v8TTIuds.unmarshal(v8TTIuds.java:104)
at oracle.jdbc.ttc7.v8Odscrarr.receive(v8Odscrarr.java:190)
at oracle.jdbc.ttc7.TTC7Protocol.describe(TTC7Protocol.java:755)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:861)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2496)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2840)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:536)
at weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:80)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:795)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:189)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:831)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:851)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
... 24 more


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 11:51 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
Bigger type length than Maximum


So, nothing to do with Hibernate then.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 2:03 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You are using some wrong type somewhere I'd say ...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 3:48 pm 
Newbie

Joined: Tue Apr 27, 2004 10:38 am
Posts: 4
Location: houston, tx
I looked up the exception and found that the oracle thin client driver puts restrictions on varchar2 types. Just switched to a type II oracle driver and that problem went away, however now I'm having problems with timestamp types. Any ideas?

Here is the stacktrace:

Hibernate: select dataidenti0_.UPDATE_DATE as x0_0_ from CME_DATA_IDENTIFIER_GROUP dataidenti0_
net.sf.hibernate.JDBCException: Could not execute query
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1580)
at net.sf.hibernate.impl.QueryImpl.iterate(QueryImpl.java:27)
at com.jpmorganchase.cment.servlet.CacheTestServlet.doGet(CacheTestServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Caused by: java.sql.SQLException: ORA-00932: inconsistent datatypes: expected %s got %s
at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:282)
at weblogic.jdbc.oci.PreparedStatement.executeQuery(PreparedStatement.java:152)
at weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:80)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:795)
at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:848)
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1577)
... 14 more


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2004 9:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Again, this is nothing we can help you with, please restrict questions in the forum to questions about Hibernate specifically. We are not experts on troubleshooting particular JDBC driver issues.


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