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.  [ 4 posts ] 
Author Message
 Post subject: Missing IN or OUT parameter at index 6 error
PostPosted: Mon Feb 06, 2006 5:44 pm 
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.1.1

Mapping documents:


------------- Person ------------

<hibernate-mapping>
<class name="com.everware.component.unittest.person.Person" table="Person">
<id column="InstanceID" name="instanceID" type="integer" unsaved-value="null">
<generator class="native" />
</id>
<property column="ID_FORMAT_CODE" insert="true" name="idFormatCode" not-null="false" type="string" unique="false" update="true" />
<property column="RELIGION_CODE" insert="true" name="religionCode" not-null="false" type="string" unique="false" update="true" />
<property column="OBSOLETE_IND" insert="true" name="obsoleteIndicator" not-null="false" type="string" unique="false" update="true" />
<property column="NICKNAME" insert="true" name="nickname" not-null="false" type="string" unique="false" update="true" />
<property column="CREATED_USERID" insert="true" name="createdUserID" not-null="true" type="string" unique="false" update="true" />
<property column="PREVIOUS_SURNAME" insert="true" name="previousSurname" not-null="false" type="string" unique="false" update="true" />
<property column="INCOME_AMT" insert="true" name="incomeAmount" not-null="false" type="double" unique="false" update="true" />
<property column="LANGUAGE_PREF_CODE" insert="true" name="languagePreferenceCode" not-null="false" type="string" unique="false" update="true" />
<property column="SURNAME" insert="true" name="surname" not-null="true" type="string" unique="false" update="true" />
<property column="FIRST_NAME" insert="true" name="firstName" not-null="true" type="string" unique="false" update="true" />
<property column="DATE_OF_BIRTH" insert="true" name="dateOfBirth" not-null="false" type="date" unique="false" update="true" />
<property column="salutation" insert="true" name="salutation" not-null="true" type="string" unique="false" update="true" />
<property column="ID_VALUE" insert="true" name="idValue" not-null="false" type="string" unique="false" update="true" />
<property column="MARITAL_STATUS_CODE" insert="true" name="maritalStatusCode" not-null="false" type="string" unique="false" update="true" />
<property column="LAST_UPDATED_TS" insert="true" name="lastUpdatedTimestamp" not-null="true" type="date" unique="false" update="true" />
<property column="DATE_OF_DEATH" insert="true" name="dateOfDeath" not-null="false" type="date" unique="false" update="true" />
<property column="GENDER_CODE" insert="true" name="genderCode" not-null="true" type="string" unique="false" update="true" />
<property column="CREATED_TS" insert="true" name="createdTimestamp" not-null="true" type="date" unique="false" update="true" />
<property column="ETHNICITY_CODE" insert="true" name="ethnicityCode" not-null="false" type="string" unique="false" update="true" />
<property column="LAST_UPDATED_USERID" insert="true" name="lastUpdatedUserID" not-null="true" type="string" unique="false" update="true" />
<property column="NAME_SUFFIX_CODE" insert="true" name="nameSuffixCode" not-null="false" type="string" unique="false" update="true" />
<property column="ID_Type_Code" insert="true" name="idTypeCode" not-null="false" type="string" unique="false" update="true" />
<property column="INCOME_FREQ_CODE" insert="true" name="incomeFrequencyCode" not-null="false" type="string" unique="false" update="true" />
<property column="MIDDLE_NAME" insert="true" name="middleName" not-null="false" type="string" unique="false" update="true" />
<property column="socialSecurityNum" insert="true" name="socialSecurityNum" not-null="false" type="string" unique="false" update="true" />
<set cascade="none" inverse="true" name="Addresss">
<key column="InstanceID" />
<one-to-many class="com.everware.component.unittest.person.Address" />
</set>
</class>
</hibernate-mapping>

------------ Address ---------------

<hibernate-mapping>
<class name="com.everware.component.unittest.person.Address" table="Address">
<id column="InstanceID" name="instanceID" type="integer" unsaved-value="null">
<generator class="native" />
</id>
<property column="address1" insert="true" name="address1" not-null="false" type="string" unique="false" update="true" />
<property column="address2" insert="true" name="address2" not-null="false" type="string" unique="false" update="true" />
<property column="city" insert="true" name="city" not-null="false" type="string" unique="false" update="true" />
<property column="state" insert="true" name="state" not-null="false" type="string" unique="false" update="true" />
<property column="zip" insert="true" name="zip" not-null="false" type="string" unique="false" update="true" />
<many-to-one cascade="none" class="com.everware.component.unittest.person.Person" name="Person">
<column name="Person"/>
</many-to-one>
<query name="findAll"><![CDATA[from Address address order by address.id asc]]></query>
</class>
</hibernate-mapping>


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

------------ Cactus Test Class -----------

...
persondao.saveOrUpdate(person);
addressdao.getSession().flush();

...
Address address = new Address();
address.setAddress1(addresses1[i % addresses1.length]);
address.setAddress2(addresses2[i % addresses2.length]);
address.setCity(cities[i % cities.length]);
address.setState(states[i % states.length]);
address.setZip(zips[i % zips.length]);

Person personkey = persondao.load(person);

address.setPerson(personkey);

address.setPerson(personkey);
addressdao.saveOrUpdate(address);

addressdao.getSession().flush();

/************************************************
persondao and addressdao extend a baseRootDao class
methods delagate to root class
/***********************************************

--------------- BaseRootDao-----------------------

protected void saveOrUpdate(Object obj) throws HibernateException {
Transaction t = null;
Session s = null;
try {
s = getSession();
t = beginTransaction(s);
saveOrUpdate(obj, s);
commitTransaction(t);
}
catch (HibernateException e) {
if (null != t) t.rollback();
throw e;
}
finally {
closeSession();
}
}




Full stack trace of any exception that occurs:

Name and version of the database you are using:

Oracle 9.0.1

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:




16:41:43,612 DEBUG SQL:346 - select hibernate_sequence.nextval from dual
16:41:43,612 DEBUG SQL:346 - insert into Person (ID_FORMAT_CODE, RELIGION_CODE,
OBSOLETE_IND, NICKNAME, CREATED_USERID, PREVIOUS_SURNAME, INCOME_AMT, LANGUAGE_P
REF_CODE, SURNAME, FIRST_NAME, DATE_OF_BIRTH, salutation, ID_VALUE, MARITAL_STAT
US_CODE, LAST_UPDATED_TS, DATE_OF_DEATH, GENDER_CODE, CREATED_TS, ETHNICITY_CODE
, LAST_UPDATED_USERID, NAME_SUFFIX_CODE, ID_Type_Code, INCOME_FREQ_CODE, MIDDLE_
NAME, socialSecurityNum, InstanceID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
****************Instance: 837
16:41:43,622 DEBUG SQL:346 - select hibernate_sequence.nextval from dual
16:41:43,622 DEBUG SQL:346 - insert into Address (address1, address2, city, stat
e, zip, Person, InstanceID) values (?, ?, ?, ?, ?, ?, ?)
16:41:43,622 INFO IntegerType:89 - could not bind value 'com.everware.component
.unittest.person.Person@79c0f4' to parameter: 6
16:41:43,632 WARN JDBCExceptionReporter:71 - SQL Error: 17041, SQLState: null
16:41:43,632 ERROR JDBCExceptionReporter:72 - Missing IN or OUT parameter at ind
ex:: 6
16:41:43,632 ERROR AbstractFlushingEventListener:299 - Could not synchronize dat
abase state with session
org.hibernate.exception.GenericJDBCException: could not insert: [com.everware.co
mponent.unittest.person.Address]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException
(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j
ava:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2078)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2427)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.ja
va:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)

at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)

at org.hibernate.event.def.AbstractFlushingEventListener.performExecutio
ns(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlus
hEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1007)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:354)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java
:106)
at com.everware.component.unittest.person.BaseRootDao.commitTransaction(
Unknown Source)
at com.everware.component.unittest.person.BaseRootDao.saveOrUpdate(Unkno
wn Source)
at com.everware.component.unittest.person.BaseAddressDao.saveOrUpdate(Un
known Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createAd
dress(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createPe
rson(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createPe
ople(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.setUp(Un
known Source)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstr
actCactusTestCase.java:149)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstra
ctWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
vletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
ice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
rector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
letTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
ce(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
ector.java)
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:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 6
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:162)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(Or
aclePreparedStatement.java:1536)
at oracle.jdbc.driver.OraclePreparedStatement.addBatch(OraclePreparedSta
tement.java:8527)
at weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_T4CPrepare
dStatement.addBatch(Unknown Source)
at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:30
)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2062)
... 41 more
org.hibernate.exception.GenericJDBCException: could not insert: [com.everware.co
mponent.unittest.person.Address]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException
(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j
ava:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2078)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2427)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.ja
va:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)

at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)

at org.hibernate.event.def.AbstractFlushingEventListener.performExecutio
ns(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlus
hEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1007)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:354)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java
:106)
at com.everware.component.unittest.person.BaseRootDao.commitTransaction(
Unknown Source)
at com.everware.component.unittest.person.BaseRootDao.saveOrUpdate(Unkno
wn Source)
at com.everware.component.unittest.person.BaseAddressDao.saveOrUpdate(Un
known Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createAd
dress(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createPe
rson(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createPe
ople(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.setUp(Un
known Source)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstr
actCactusTestCase.java:149)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstra
ctWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
vletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
ice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
rector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
letTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
ce(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
ector.java)
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:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 6
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:162)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(Or
aclePreparedStatement.java:1536)
at oracle.jdbc.driver.OraclePreparedStatement.addBatch(OraclePreparedSta
tement.java:8527)
at weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_T4CPrepare
dStatement.addBatch(Unknown Source)
at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:30
)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2062)
... 41 more
16:41:43,632 DEBUG SQL:346 - select hibernate_sequence.nextval from dual
16:41:43,642 DEBUG SQL:346 - insert into Person (ID_FORMAT_CODE, RELIGION_CODE,
OBSOLETE_IND, NICKNAME, CREATED_USERID, PREVIOUS_SURNAME, INCOME_AMT, LANGUAGE_P
REF_CODE, SURNAME, FIRST_NAME, DATE_OF_BIRTH, salutation, ID_VALUE, MARITAL_STAT
US_CODE, LAST_UPDATED_TS, DATE_OF_DEATH, GENDER_CODE, CREATED_TS, ETHNICITY_CODE
, LAST_UPDATED_USERID, NAME_SUFFIX_CODE, ID_Type_Code, INCOME_FREQ_CODE, MIDDLE_
NAME, socialSecurityNum, InstanceID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
****************Instance: 839
16:41:43,642 DEBUG SQL:346 - select hibernate_sequence.nextval from dual
16:41:43,652 DEBUG SQL:346 - insert into Address (address1, address2, city, stat
e, zip, Person, InstanceID) values (?, ?, ?, ?, ?, ?, ?)
16:41:43,652 INFO IntegerType:89 - could not bind value 'com.everware.component
.unittest.person.Person@1a6fb3' to parameter: 6
16:41:43,652 WARN JDBCExceptionReporter:71 - SQL Error: 17041, SQLState: null
16:41:43,652 ERROR JDBCExceptionReporter:72 - Missing IN or OUT parameter at ind
ex:: 6
16:41:43,652 ERROR AbstractFlushingEventListener:299 - Could not synchronize dat
abase state with session
org.hibernate.exception.GenericJDBCException: could not insert: [com.everware.co
mponent.unittest.person.Address]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException
(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j
ava:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2078)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2427)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.ja
va:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)

at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)

at org.hibernate.event.def.AbstractFlushingEventListener.performExecutio
ns(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlus
hEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1007)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:354)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java
:106)
at com.everware.component.unittest.person.BaseRootDao.commitTransaction(
Unknown Source)
at com.everware.component.unittest.person.BaseRootDao.saveOrUpdate(Unkno
wn Source)
at com.everware.component.unittest.person.BaseAddressDao.saveOrUpdate(Un
known Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createAd
dress(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createPe
rson(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createPe
ople(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.setUp(Un
known Source)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstr
actCactusTestCase.java:149)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstra
ctWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
vletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
ice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
rector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
letTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
ce(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
ector.java)
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:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 6
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:162)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(Or
aclePreparedStatement.java:1536)
at oracle.jdbc.driver.OraclePreparedStatement.addBatch(OraclePreparedSta
tement.java:8527)
at weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_T4CPrepare
dStatement.addBatch(Unknown Source)
at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:30
)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2062)
... 41 more
org.hibernate.exception.GenericJDBCException: could not insert: [com.everware.co
mponent.unittest.person.Address]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException
(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.j
ava:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelp
er.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2078)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2427)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.ja
va:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)

at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)

at org.hibernate.event.def.AbstractFlushingEventListener.performExecutio
ns(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlus
hEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1007)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:354)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java
:106)
at com.everware.component.unittest.person.BaseRootDao.commitTransaction(
Unknown Source)
at com.everware.component.unittest.person.BaseRootDao.saveOrUpdate(Unkno
wn Source)
at com.everware.component.unittest.person.BaseAddressDao.saveOrUpdate(Un
known Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createAd
dress(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createPe
rson(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.createPe
ople(Unknown Source)
at com.everware.component.unittest.person.PersonTestCaseWrapper.setUp(Un
known Source)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstr
actCactusTestCase.java:149)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstra
ctWebTestCaller.java:119)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody0(AbstractWebTestController.java:93)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest_aroundBody1$advice(AbstractWebTestController.java:224)
at org.apache.cactus.internal.server.AbstractWebTestController.handleReq
uest(AbstractWebTestController.java)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
vletTestRedirector.java:101)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
ice(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
rector.java)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
letTestRedirector.java:72)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
ce(ServletTestRedirector.java:224)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
ector.java)
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:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 6
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:162)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(Or
aclePreparedStatement.java:1536)
at oracle.jdbc.driver.OraclePreparedStatement.addBatch(OraclePreparedSta
tement.java:8527)
at weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_T4CPrepare
dStatement.addBatch(Unknown Source)
at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:30
)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(Abstrac
tEntityPersister.java:2062)


Top
  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 9:22 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
If you're going to post that much in one go, you'll have to make it as legible as possible. Try reposting with suitably-positioned code tags.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 12:53 pm 
OK let me try and scale it down then. This is a master detail bidirectional on 2 tables. The Primary is PERSON and the Foreign is ADDRESS. The basic thrust is why Hibernate cannot map/bind person properly for the ADDRESS table during the INSERT. The PERSON INSERT works fine.

_____________________________________________________________
16:41:43,632 DEBUG SQL:346 - select hibernate_sequence.nextval from dual
16:41:43,642 DEBUG SQL:346 - insert into Person (ID_FORMAT_CODE, RELIGION_CODE,
OBSOLETE_IND, NICKNAME, CREATED_USERID, PREVIOUS_SURNAME, INCOME_AMT, LANGUAGE_P
REF_CODE, SURNAME, FIRST_NAME, DATE_OF_BIRTH, salutation, ID_VALUE, MARITAL_STAT
US_CODE, LAST_UPDATED_TS, DATE_OF_DEATH, GENDER_CODE, CREATED_TS, ETHNICITY_CODE
, LAST_UPDATED_USERID, NAME_SUFFIX_CODE, ID_Type_Code, INCOME_FREQ_CODE, MIDDLE_
NAME, socialSecurityNum, InstanceID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
****************Instance: 839
16:41:43,642 DEBUG SQL:346 - select hibernate_sequence.nextval from dual
16:41:43,652 DEBUG SQL:346 - insert into Address (address1, address2, city, stat
e, zip, Person, InstanceID) values (?, ?, ?, ?, ?, ?, ?)
16:41:43,652 INFO IntegerType:89 - could not bind value 'com.everware.component
.unittest.person.Person@1a6fb3' to parameter: 6
16:41:43,652 WARN JDBCExceptionReporter:71 - SQL Error: 17041, SQLState: null
16:41:43,652 ERROR JDBCExceptionReporter:72 - Missing IN or OUT parameter at ind ex:: 6
_________________________________________________________

So having said that the important points of the descriptor is probably the relationships.


_______________________________________________________
This is PERSON


<id column="InstanceID" name="instanceID" type="integer" unsaved-value="null">
<generator class="native" />
</id>

<set cascade="none" inverse="true" name="Addresss">
<key column="InstanceID" />
<one-to-many class="com.everware.component.unittest.person.Address" />
</set>

___________________________________________________________
This is Address

<id column="InstanceID" name="instanceID" type="integer" unsaved-value="null">
<generator class="native" />
</id>

<many-to-one cascade="none" class="com.everware.component.unittest.person.Person" name="Person">
<column name="Person"/>
</many-to-one>
____________________________________________________________

The bean classes all generate fine. And the code is pretty standard for doing the save. Basically I'm saving Person first committing the transaction then doing the address.

Is this possible due to the fact that ADDRESS and PERSON both have PRIMARY KEYS called INSTANCEID ?

I also attempted a variation of this where saved person. Did a flush(). Then did a Load() on the person just saved set the Address and did a SaveUpdate. Note is correctly generating an INSERT for the Address. This was discussed in one of the messages.
____________________________________________________________

Anyway I hope someone can take a serious look at this and tell me what the issue is. I can only do what the documentation tells me and seems like this should be working.


Top
  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 5:34 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
For some reason, the Person object instead of Person.InstanceId is being bound to the appropriate parameter in the SQL statement. I'm trying to figure out these lines from your original post:
Code:
persondao.saveOrUpdate(person);
/* ... */
Person personkey = persondao.load(person);

address.setPerson(personkey);

address.setPerson(personkey);
addressdao.saveOrUpdate(address);

If personkey and person are the same object, then everything should be working fine: in this case, why are you loading the person object using the person object? If personkey is the identifier for the person object, then I don't understand what you're trying to do. Your mapping says that address.setPerson() takes a Person object as a parameter, but you're passing in an identifier? Can you explain what that chunk of code is supposed to be doing?


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