Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.x
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Aug 24, 2006 1:19:45 PM by Hibernate Tools 3.2.0.beta6a -->
<hibernate-mapping>
<class name="org.ridoc.orm.Identification" table="IDENTIFICATION" schema="DBARI">
<id name="IInmateId" type="int">
<column name="I_INMATE_ID" precision="7" scale="0" />
<generator class="assigned" />
</id>
<property name="ILastName" type="string">
<column name="I_LAST_NAME" length="18" not-null="true" />
</property>
<property name="IFirstName" type="string">
<column name="I_FIRST_NAME" length="15" not-null="true" />
</property>
<property name="IMinit" type="string">
<column name="I_MINIT" length="1" />
</property>
<property name="ISuffix" type="string">
<column name="I_SUFFIX" length="4" />
</property>
<property name="ISecurityId" type="string">
<column name="I_SECURITY_ID" length="3" />
</property>
<property name="IArea" type="string">
<column name="I_AREA" length="8" />
</property>
<property name="ICellId" type="string">
<column name="I_CELL_ID" length="6" />
</property>
Code between sessionFactory.openSession() and session.close():
Using Spring to open/Close the Session.
Full stack trace of any exception that occurs:
[INFO] IntegerType - -could not bind value '911%' to parameter: 1
[WARN] JDBCExceptionReporter - -SQL Error: 1008, SQLState: 72000
[ERROR] JDBCExceptionReporter - -ORA-01008: not all variables bound
[ stacktrace ] -----------------------------------------------------------
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2153)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1551)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at org.ridoc.dao.hibernate.HibernateOffenderDao.readIdentification(HibernateOffenderDao.java:111)
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:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy2.readIdentification(Unknown Source)
at org.ridoc.dao.AppTest.testIdent(AppTest.java:89)
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:585)
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 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:585)
at org.apache.maven.surefire.battery.JUnitBattery.executeJUnit(JUnitBattery.java:242)
at org.apache.maven.surefire.battery.JUnitBattery.execute(JUnitBattery.java:216)
at org.apache.maven.surefire.Surefire.executeBattery(Surefire.java:215)
at org.apache.maven.surefire.Surefire.run(Surefire.java:163)
at org.apache.maven.surefire.Surefire.run(Surefire.java:87)
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:585)
at org.apache.maven.surefire.SurefireBooter.runTestsInProcess(SurefireBooter.java:285)
at org.apache.maven.surefire.SurefireBooter.run(SurefireBooter.java:201)
at org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:366)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:432)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:530)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:472)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:303)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:270)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:139)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
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:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.sql.SQLException: ORA-01008: not all variables bound
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:880)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2516)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2850)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:537)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:91)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2150)
... 64 more
Name and version of the database you are using:
Oracle 9i2
The generated SQL (show_sql=true):
select this_.I_INMATE_ID as I1_142_0_, this_.I_LAST_NAME as I2_142_0_, this_.I_FIRST_NAME as I3_142_0_, this_.I_MINIT as I4_142_0_, this_.I_SUFFIX as I5_142_0_, this_.I_SECURITY_ID as I6_142_0_, this_.I_AREA as I7_142_0_, this_.I_CELL_ID as I8_142_0_, this_.I_FBI as I9_142_0_, this_.I_FP_NBR as I10_142_0_, this_.I_DOB as I11_142_0_, this_.I_RACE as I12_142_0_, this_.I_SEX as I13_142_0_, this_.I_STATUS as I14_142_0_, this_.I_CLASS_CODE as I15_142_0_, this_.I_DETAINERS_1 as I16_142_0_, this_.I_DETAINERS_2 as I17_142_0_, this_.I_DETAINERS_3 as I18_142_0_, this_.I_DETAINERS_4 as I19_142_0_, this_.I_DETAINERS_5 as I20_142_0_, this_.I_PC_INDICATOR as I21_142_0_, this_.I_PC_REASON as I22_142_0_, this_.I_STATUS_DATE as I23_142_0_, this_.I_PAROLE_DATE as I24_142_0_, this_.I_SENTENCED as I25_142_0_, this_.I_ESCAPE_DATE as I26_142_0_, this_.I_RET_ESCAPE_DATE as I27_142_0_, this_.I_HOMCONF_DATE as I28_142_0_, this_.I_RET_HOMCONF_DATE as I29_142_0_, this_.I_HWOB_FLAG as I30_142_0_, this_.I_DRUG_ABUSE as I31_142_0_, this_.I_HIV_CODE as I32_142_0_, this_.I_SSNO as I33_142_0_, this_.I_TOTAL_BAIL as I34_142_0_, this_.I_TOTAL_SURETY as I35_142_0_, this_.I_TOTAL_DBL_SURETY as I36_142_0_, this_.I_BAIL_TO_BE_PAID as I37_142_0_, this_.I_COUNT_NAMES as I38_142_0_, this_.I_PEND_CHG as I39_142_0_, this_.I_V_DOB as I40_142_0_, this_.I_OOAK as I41_142_0_, this_.I_HWOB_MESG as I42_142_0_, this_.I_HEALTH_ALERT as I43_142_0_, this_.I_DAY_PASS as I44_142_0_, this_.I_OVER_PASS as I45_142_0_, this_.I_JOB_CODE as I46_142_0_, this_.I_LIMIT_COUNT as I47_142_0_, this_.I_FURLOW_HISTORY as I48_142_0_, this_.I_AG_PAROLE_FLAG as I49_142_0_, this_.I_VISIT_COMMENT as I50_142_0_, this_.I_BIN_NUMBER as I51_142_0_, this_.I_CATEGORY as I52_142_0_, this_.I_ENEMIES as I53_142_0_, this_.I_ENEMIES_OF as I54_142_0_, this_.I_TOT_ENEMIES as I55_142_0_, this_.I_FP_NBR2 as I56_142_0_, this_.I_FP_CLASS1 as I57_142_0_, this_.I_FP_CLASS2 as I58_142_0_, this_.I_SMOKER as I59_142_0_, this_.I_RESIDE_WITH_SMOKER as I60_142_0_, this_.I_DATE_PHOTO_TAKEN as I61_142_0_, this_.I_SOS_CODE as I62_142_0_, this_.I_SOS_LOCATION as I63_142_0_, this_.I_SOS_STATE as I64_142_0_, this_.I_SRG as I65_142_0_, this_.I_REASON_CODE as I66_142_0_, this_.I_RACE_5 as I67_142_0_, this_.I_COMM_CONF_ELIG_DATE as I68_142_0_, this_.I_GD_DATE as I69_142_0_, this_.I_LIFE_TYPE as I70_142_0_, this_.I_MED_REQ_BOT_BUNK as I71_142_0_, this_.I_OUT_OF_STATER as I72_142_0_, this_.I_SPANISH_LANG as I73_142_0_, this_.I_M_ADDRESS_DATE as I74_142_0_, this_.I_R_ADDRESS_DATE as I75_142_0_, this_.I_PP_STATUS as I76_142_0_, this_.I_PIN_NO as I77_142_0_, this_.I_INCARCERATION_NUMBER as I78_142_0_, this_.I_ADMISSION_TYPE as I79_142_0_, this_.I_RELEASE_TYPE as I80_142_0_, this_.I_CURRENT_TYPE as I81_142_0_, this_.I_NONST_INMATE_TYPE as I82_142_0_, this_.I_ST_OR_NONST as I83_142_0_, this_.I_COMMENTS as I84_142_0_, this_.I_ENEMY_LEVEL as I85_142_0_, this_.I_BCI_NUMBER as I86_142_0_ from DBARI.IDENTIFICATION this_ where (lower(this_.I_INMATE_ID) like ?)
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html
===============================================
===============================================
Hi All,
I'm trying to convert this HQL query:
Code:
.find("from Identification where IInmateId LIKE '911%'")
to a Criteria Query. The problem is that the field IInmateId in an integer and in the java class it is defined as type java.util.Integer. So if I can not create my Criteria Query like this:
Code:
criteria.add(Restrictions.like("IInmateId",new Integer("911%")))
because the Integer object will not take "911%" as a value. And when I try to do this:
Code:
criteria.add(Restrictions.like("IInmateId","911%"))
the above exception gets thrown.
Is there some other way I can get this to work???
TIA,