FW: Iterate problem

2006-10-03 Thread Niels Beekman








Please keep discussion on the list, so
others can benefit as well. I dont have experience with batch updates or
multiple refcursors, have you searched the archives yet?



Niels











From: Gopal
[mailto:[EMAIL PROTECTED] 
Sent: dinsdag 3 oktober 2006 14:23
To: Niels Beekman
Subject: Iterate problem







hi,











I'm Gopal chennai, India. can u pls help me out in
iBATIS. i have few questions. can u pls address?











how to acheive batch updates and inserts?





how to get a multiple refcursors from a stored procedures?











Thanks in advance











Best Regards,


Gopal. R
Kumaran Systems
















Re: Stored procedures (package functions) returning a row

2006-10-03 Thread Jeff Butler
There are two different issues here.

1. Oracle can't find your function. I don't know how to resolve that one, but you have to figure that out first. Maybe the function is not really in the package/schema you've specified?

2. Only use queryForObject if the function returns a result set. If it is just returning a single value, then call it with syntax like this:

{? = call myFunction}

Register an output parameter - not a resultMap - then call it with the update method.

Unfortunatley, the iBATIS stored procedure support is hard to understand - it makes sense if you really understand JDBC, but probably doesn't otherwise. The most important thing to remember is this - when iBATIS uses the term result (resultMap, resultClass, etc.) it ALWAYS refers to a result set. A single value returned from a procedure or function is NOT a result in iBATIS - it is an output parameter.


Jeff Butler

On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


The log generated by log4j confirms that the PreparedStatement is correctly preparedDEBUG [main] - Created connection 22664464.DEBUG [main] - {conn-10} Connection
DEBUG [main] - {pstm-11} PreparedStatement: {call ut_Tipo_Dato.ut_setup}DEBUG [main] - {pstm-11} Parameters: []
DEBUG [main] - {pstm-11} Types: []DEBUG [main] - Returned connection 22664464 to pool.DEBUG [main] - Checked out connection 22664464 from pool.
DEBUG [main] - {conn-12} ConnectionDEBUG [main] - {pstm-13} PreparedStatement: {call ut_Tipo_dato.get_key_2
}DEBUG [main] - {pstm-13} Parameters: []DEBUG [main] - {pstm-13} Types: []DEBUG [main] - Returned connection 22664464 to pool.
com.ibatis.common.jdbc.exception.NestedSQLException: 
--- The error occurred in it/finmatica/gpj/aa/frontebd/DizionarioTipiDatoTest.xml. --- The error occurred while applying a parameter map. 
--- Check the get_key_2-InlineParameterMap. --- Check the statement (update procedure failed). --- Cause: 
java.sql.SQLException: ORA-06550: line 1, column 7:PLS-00221: 'GET_KEY_2' is not a procedure or is undefined
ORA-06550: line 1, column 7:PL/SQL: Statement ignoredCaused by: 
java.sql.SQLException: ORA-06550: line 1, column 7:PLS-00221: 'GET_KEY_2' is not a procedure or is undefined
ORA-06550: line 1, column 7:PL/SQL: Statement ignoredat com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback
(GeneralStatement.java:185)at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject
(GeneralStatement.java:104)[...]Something is wrong on the stored code? It wouldn't seem A mini test harness written on-th-gfly runs correctly.
The Oracle diagnostic does not mention 'UT_TIPO_DATO.GET_KEY_2' (instead it reports 'GET_KEY_2' without mentioning its package)Why does the diagnostic refer a parameterMap / the inline parameter of get_key_2?
--- The error occurred while applying a parameter map. --- Check the get_key_2-InlineParameterMap. 
The XML config file does NOT mention any parameterresultMap id=mapChiave class=it.finmatica.gpj.aa.frontebd.ChiaveBean
result property=id column=TIPO_DATO_ID//resultMap
procedure id=get_key_2 resultMap=mapChiave{call ut_Tipo_dato.get_key_2}/procedureIf, I've understood well the Jeff's suggestions
http://opensource.atlassian.com/confluence/oss/pages/diffpages.action?pageId=39originalId=5835
a call to queryForObject is suitable when you get only one object as result.What is wrong?I'm confused.


Re: Stored procedures (package functions) returning a row

2006-10-03 Thread C . Zecca

Jeff Butler [EMAIL PROTECTED] scritti il 03/10/2006 14:59:55

 There are two different issues here.

[...] 
 
 2. Only use queryForObject if the function returns a result set. If
 it is just returning a single value, then call it with syntax like this:
 
 {? = call myFunction}
 
 Register an output parameter - not a resultMap - then call it with 
 the update method.

I will investigate asap the doc and the list for the suggested approach
(a search about output parameter and ? = in the pdf Developer guide has just reported no occurrences :/)
Anyway, please note that the returned value is actually a record type (a row).
I hope that it's possible to get, via output parameters, not only simple SQL types but record types (rows) as well.


 Unfortunatley, the iBATIS stored procedure support is hard to 
 understand - it makes sense if you really understand JDBC, but 
 probably doesn't otherwise. The most important thing to remember is
 this - when iBATIS uses the term result (resultMap, resultClass, 
 etc.) it ALWAYS refers to a result set. A single value returned 
 from a procedure or function is NOT a result in iBATIS - it is an 
 output parameter. 

Right, Jeff!
I have no experience (or very little) about JDBC.
I trusted some critics and colleagues that suggest iBatis because very useful
to approach a DB from Java code without concern for many tedious details that you have to face with direct
programming of JDBC.
Does it help (I mean for teh documentation)? I mean that ... there is one user, at least, that directly passed JDBC by.
:)


Let'me experiment.
I will report any result as soon as possible

ciao

Automatic rollback with Spring for junit tests ?

2006-10-03 Thread erlend.bjorge








Hi there!



Im trying to set
up some junit tests and want to take automatically a rollback for each test, in
a Spring context.



Any clues how to set this
property transactionManager (see below for the error) correctly in Spring ? 



I have tried to use the AbstractTransactionalSpringContextTests
feature from Spring without any luck so far.

With the AbstractSpringContextTests
it works fine.





Thanks,

Erlend



--



I get this error:



..

..

2006-10-03 15:53:01,734
[INFO  ] [main  ]
org.springframework.context.support.ClassPathXmlApplicationContext - Unable to
locate MessageSource with name 'messageSource': using default
[EMAIL PROTECTED]

2006-10-03 15:53:01,734
[INFO  ] [main  ]
org.springframework.context.support.ClassPathXmlApplicationContext - Unable to
locate ApplicationEventMulticaster with name 'applicationEventMulticaster':
using default [EMAIL PROTECTED]

2006-10-03 15:53:01,734
[INFO  ] [main  ]
org.springframework.beans.factory.support.DefaultListableBeanFactory -
Pre-instantiating singletons in factory
[org.springframework.beans.factory.support.DefaultListableBeanFactory defining
beans [configurator,sqlMapClient,sqlMapClientTemplate,contactDao,dataSource];
root of BeanFactory hierarchy]



org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'no.aftenposten.contactinfo.dao.ibatis.ContactDaoTest':
Unsatisfied dependency expressed through bean property 'transactionManager':
set this property value or disable dependency checking for this bean

    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.checkDependencies(AbstractAutowireCapableBeanFactory.java:995)

    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:856)

    at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:227)

    at
org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp(AbstractDependencyInjectionSpringContextTests.java:187)

    at
com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)

    at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

--



My spring-dao.xml 



 !-- Section 4
--

    bean
id=sqlMapClient
class=org.springframework.orm.ibatis.SqlMapClientFactoryBean

    property
name=configLocation

   
valueclasspath:sql/SqlMap-config.xml/value

    /property

    property
name=useTransactionAwareDataSource

   
valuefalse/value

    /property

    property
name=dataSource

    ref
bean=dataSource/

    /property

    /bean



    !-- Section 5
--

    bean
id=sqlMapClientTemplate class=org.springframework.orm.ibatis.SqlMapClientTemplate

    property
name=sqlMapClient

    ref
bean=sqlMapClient/

    /property

    /bean



    !-- Section 6
--

    bean
id=contactDao
class=no.aftenposten.contactinfo.dao.ibatis.ContactDaoImpl

    property
name=sqlMapClient

    ref
bean=sqlMapClient/

    /property

    /bean



    !--
javax.sql.DataSource supplied by Jakarta Commons Connection Pooling --

    bean
id=dataSource lazy-init=true class=org.apache.commons.dbcp.BasicDataSource
destroy-method=close

    property
name=driverClassName

   
value${application.db.driver}/value

    /property

    property
name=url

   
value${application.db.url}/value

    /property

    property
name=username

   
value${application.db.username}/value

    /property

    property
name=password

   
value${application.db.password}/value

    /property

    /bean








Re: FW: Iterate problem

2006-10-03 Thread Ayananshu Monpara

Ibatis 2.2 is having support for procedure
calls which returns multiple refcursors. For that you have to configure
ParameterMaps  ResultMaps containing individual ParameterMap 
ResultMap respectivly, 

You can refer to following simple ex:

http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=5653

You can also refer to iBatis developer's
pdf for mapping  related stuf, even though its more like spec , whick
i feel boring

Regards






Niels Beekman
[EMAIL PROTECTED] 
10/03/2006 08:38 AM



Please respond to
user-java@ibatis.apache.org





To
user-java@ibatis.apache.org


cc



Subject
FW: Iterate problem








Please keep discussion on the
list, so others can benefit as well. I don’t have experience with batch
updates or multiple refcursors, have you searched the archives yet?

Niels




From: Gopal [mailto:[EMAIL PROTECTED]

Sent: dinsdag 3 oktober 2006 14:23
To: Niels Beekman
Subject: Iterate problem

hi,

I'm Gopal chennai, India. can u pls help
me out in iBATIS. i have few questions. can u pls address?

how to acheive batch updates and inserts?
how to get a multiple refcursors from a stored
procedures?

Thanks in advance

Best Regards,


Gopal. R
Kumaran Systems



Disclaimer: This electronic mail and any attachments are confidential and may be privileged. If you are not the intended recipient, please notify the sender immediately by replying to this email, and destroy all copies of this email and any attachments. Thank you.



SV: Automatic rollback with Spring for junit tests ? SOLUTION :-)

2006-10-03 Thread erlend.bjorge








Hi there!



I was struggling with this
problem, then I finally realized the problem, ME J



I have been using Hibernate
with Spring (someone else has setup the transactionManager stuff), and when 
I realized what I was actually missing then wola J This line here in the spring-dao.xml file of course J



    bean
id=transactionManager
class=org.springframework.jdbc.datasource.DataSourceTransactionManager

    property
name=dataSource

    ref
bean=dataSource/

    /property

    /bean



But are other better ways
to do it ?



--



Anyway nice Ibatis/Spring
links:



http://www.learntechnology.net/struts-spring-ibatis.do  
(The example I was using, but they didnt have the transactionManager
setup)



Reading this I figured it
all out J



http://www.springframework.org/docs/reference/orm.html#orm-ibatis





Take care,

Erlend










RE: Stored procedures (package functions) returning a row

2006-10-03 Thread Christopher . Mathrusse



This is an Oracle generated message and it's telling you rather clearly 
that your procedure cannot be found.
--- Cause: java.sql.SQLException: ORA-06550: 
line 1, column 7:PLS-00221: 'GET_KEY_2' is not a procedure or is 
undefinedORA-06550: line 1, 
column 7:

One 
thing that I would suggest is that while the procedure might exist within your 
schema it might not be valid, meaning that it might contain errors. Please look 
to see if the procedure has errors. If it does then Oracle will tell you that it 
does not exist and that is because it is not 
valid.

There are only a few 
possibilities here:

  
  The procedure does not 
  exist
  
  The procedure exists but 
  is not contained within the package/schema that you are 
  specifying.
  
  The procedure exists but 
  is invalid due to compilation errors.
ThisisclearlynotaproblemwithiBatisorwiththewaythattheprocedureisbeingcall.ThisissimplyanissuewithintheOracleschemathatyouareusing.



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 03, 2006 3:56 AMTo: 
user-java@ibatis.apache.orgSubject: Re: Stored procedures (package 
functions) returning a row

The log generated by log4j confirms that the PreparedStatement is correctly 
preparedDEBUG [main] - Created connection 
22664464.DEBUG [main] - {conn-10} 
ConnectionDEBUG [main] - {pstm-11} 
PreparedStatement: {call ut_Tipo_Dato.ut_setup}DEBUG [main] - {pstm-11} Parameters: []DEBUG [main] - {pstm-11} Types: []DEBUG [main] - Returned connection 22664464 to 
pool.DEBUG [main] - Checked out connection 
22664464 from pool.DEBUG [main] - 
{conn-12} ConnectionDEBUG [main] - 
{pstm-13} PreparedStatement: {call ut_Tipo_dato.get_key_2}DEBUG [main] - 
{pstm-13} Parameters: []DEBUG [main] - 
{pstm-13} Types: []DEBUG [main] - 
Returned connection 22664464 to pool.com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in 
it/finmatica/gpj/aa/frontebd/DizionarioTipiDatoTest.xml. --- The error occurred while applying a 
parameter map. --- Check the 
get_key_2-InlineParameterMap. --- Check the statement (update procedure failed). 
--- Cause: java.sql.SQLException: ORA-06550: line 1, column 7:PLS-00221: 'GET_KEY_2' is not a procedure or is 
undefinedORA-06550: line 1, 
column 7:PL/SQL: Statement 
ignoredCaused by: 
java.sql.SQLException: ORA-06550: line 1, column 7:PLS-00221: 'GET_KEY_2' is not a procedure or is 
undefinedORA-06550: line 1, 
column 7:PL/SQL: Statement 
ignoredat 
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)at 
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)[...]Something is wrong on the stored code? It 
wouldn't seem A mini test harness written on-th-gfly runs correctly.The 
Oracle diagnostic does not mention 'UT_TIPO_DATO.GET_KEY_2' (instead it reports 
'GET_KEY_2' without mentioning its package)Why does the diagnostic refer 
a parameterMap / the inline parameter of get_key_2?--- The error occurred while applying a parameter map. 
--- Check the 
get_key_2-InlineParameterMap. The XML config file does NOT 
mention any parameterresultMap 
id="mapChiave" 
class="it.finmatica.gpj.aa.frontebd.ChiaveBean"result property="id" 
column="TIPO_DATO_ID"//resultMapprocedure 
id="get_key_2" resultMap="mapChiave"{call ut_Tipo_dato.get_key_2}/procedureIf, I've understood well the 
Jeff's suggestionshttp://opensource.atlassian.com/confluence/oss/pages/diffpages.action?pageId=39originalId=5835a 
call to queryForObject is suitable when you get only one object as 
result.What is wrong?I'm confused. 



Re: What is purpose of TypeHandler

2006-10-03 Thread C . Zecca

Gwyn Evans wrote:

 Take a look at the Creating custom Type Handlers section of the
 iBATIS-SqlMaps-2.pdf for an example that shows how a java boolean
 might be mapped to/from Y or N values in a DB field.

[...]

 Hmm, seemed anything but abstract to me.  Suggest you take another
 look at the documentation, maybe searching for the string
 typeHandler. 

[...]

Well, in iBATIS-SqlMaps-2.pdf there are neither occurrences of Type Handlers nor of  typeHandler

The link in the wiki reported by Poitras Christian
http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=422
refers to C sharp

I want now to understand how to get a unique value (it is NOT a result set) 
actually a row (PL/SQL record type) from a package function.
http://www.mail-archive.com/user-java@ibatis.apache.org/msg06410.html

Let's see...


Re: What is purpose of TypeHandler

2006-10-03 Thread Jeff Butler
I suggest that you look again...there are MANY references to type handlers in the developer's guide. Page 41 in the latest version contains a complete example.

If you need a newer version of the developer's guide, get it here:

http://ibatis.apache.org/javadownloads.html


Jeff Butler

On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


Gwyn Evans wrote: Take a look at the Creating custom Type Handlers section of the iBATIS-SqlMaps-2.pdf for an example that shows how a java boolean might be mapped to/from Y or N values in a DB field.
[...] Hmm, seemed anything but abstract to me. Suggest you take another look at the documentation, maybe searching for the string typeHandler. [...]Well, in 
iBATIS-SqlMaps-2.pdf there are neither occurrences of Type Handlers nor of typeHandlerThe link in the wiki reported by Poitras Christian
http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=422refers to C sharpI want now to understand how to get a unique value (it is NOT a result set) actually a row (PL/SQL 
record type) from a package function.http://www.mail-archive.com/user-java@ibatis.apache.org/msg06410.html
Let's see...


TransactionManager could not end this transaction

2006-10-03 Thread Espenschied, Jim










I am trying to use iBatis DAOs 2.2.0 build# 638 with IBM
Websphere v6 using data source version 4. I am having problems with
transactions in the DaoProxy invoke method. Here is the iBatis code along with
the exception that I get. The exception is thrown
from
context.commitTransaction() in the last else statement in DaoProxy. I can
comment out this line and it will work with no exceptions. I have also included
the configuration for my data source and my code that calls queryForList.
Please note that I am overriding the data source with
setUserConnection(connection) and my class with the method queryForList extends
SqlMapDaoTemplate. I do not need to have any 2 phase commits. What am I
missing? Any help would be greatly appreciated.



Thanks,



Jim



 public List queryForList(String name,
Object parameters)

 {

 Connection
connection = null;

 List results =
null;

 try{


connection = this.getDataSource().getConnection();


this.getSqlMapTransactionManager().setUserConnection(connection);


results = super.queryForList(name, parameters);


connection.commit();

 } catch
(SQLException e) {


try {


if (connection != null) connection.rollback();


} catch (SQLException ignored) {


// generally ignored


}


//throw e; // rethrow the exception

 } finally {


try {


if (connection != null)


{


connection.close();


}


} catch (SQLException ignored) {


// generally ignored


}

 }

}



transactionManager type=JDBC


 dataSource type=JNDI


property name=DataSource value=jdbc/DataSource/


/dataSource

/transactionManager





public Object
invoke(Object proxy, Method method, Object[] args)

 throws Throwable {

 Object result = null;

 if
(PASSTHROUGH_METHODS.contains(method.getName())) {

 try {

 result =
method.invoke(daoImpl.getDaoInstance(), args);

 } catch (Throwable t) {

 throw ClassInfo.unwrapThrowable(t);

 }

 } else
{

 StandardDaoManager daoManager
= daoImpl.getDaoManager();

 DaoContext context =
daoImpl.getDaoContext();



 if (daoManager.isExplicitTransaction()) {

 // Just start the
transaction (explicit)

 try {


context.startTransaction();


result = method.invoke(daoImpl.getDaoInstance(), args);

 } catch (Throwable t) {

 throw ClassInfo.unwrapThrowable(t);

 }

 } else {

 // Start, commit
and end the transaction (autocommit)

 try {


context.startTransaction();


result = method.invoke(daoImpl.getDaoInstance(), args);


context.commitTransaction();

 } catch (Throwable t) {

 throw ClassInfo.unwrapThrowable(t);

 } finally {


context.endTransaction();

 }

 }



 }

 return
result;

 }



com.ibatis.dao.client.DaoException: Error ending SQL Map
transaction. Cause: com.ibatis.common.jdbc.exception.NestedSQLException: Error
while ending transaction. Cause: com.ibatis.sqlmap.engine.transaction.TransactionException:
TransactionManager could not end this transaction. A user provided connection
is currently being used by this session. You must call the rollback() method of
the Connection directly. The calling .setUserConnection (null) will clear the
user provided transaction.
Caused by: com.ibatis.sqlmap.engine.transaction.TransactionException:
TransactionManager could not end this transaction. A user provided connection
is currently being used by this session. You must call the rollback() method of
the Connection directly. The calling .setUserConnection (null) will clear the
user provided transaction.










RE: Stored procedures (package functions) returning a row

2006-10-03 Thread C . Zecca

Thanks, Christopher!

I tried hard to check everything on the DB side. The ut_Tipo_dato package is in a good state (at least while it's observed via PLSQL Developer)
and compiles correctly. It is run successfuly by OUnit (I've performed the test just now)
I wrote, as well, a mini test harness that works fine

declare 
  -- Local variables here
  primaryKey Tipo_Dato.t_PK;
  i number(10);
begin
  -- Test statements here
  
  ut_Tipo_dato.ut_setup;
  primaryKey := ut_Tipo_dato.get_key_2;
  i := primaryKey.tipo_dato_ID;
  dbms_output.put_line( 'key_2 i = ' || to_char( i ) );  
  
  ut_Tipo_dato.ut_teardown;
end;

I know that there are a number of details which, all together, at the same time, make the thing hard.
I'm approaching to iBatis without a good knowledge of JDBC:

Now I'm trrying to understand
1) when I have to call update() when I have to call queryForObject()
2) let's assume that working with an ouput (result ?) parameter is correct. How can I describe a result parameter that has to be mapped to a PL/SQL record type?

The examples I've found in this mailing list (e.g http://www.mail-archive.com/user-java@ibatis.apache.org/msg00998.html)
describe parameter property=result .../ that are mapped onto SQL basic types

Is not the difficolty to retrieve ut_Tipo_dato.get_key_2 due to some other problem?
I gues that my monkey user approach to iBatis (a very fist beginner that has no knowledege of JDCB, too) implies a number of errors that, all together, make impossible to retrieve the stored package function (and perhaps event to run it).

Thank you for your help
(I hope that my naive approaching and the issues that I raise might be of some help)
I've just received a mail from Jeff and... probably, the version of the Developer Guide I consult (version 2.0) is not the last one  :S

ciao
Cesare

[EMAIL PROTECTED]








[EMAIL PROTECTED] 
03/10/2006 17:22

Per favore, rispondere a
user-java@ibatis.apache.org








Per
[EMAIL PROTECTED], user-java@ibatis.apache.org


CC



Oggetto
RE: Stored procedures (package functions) returning a row








This is an Oracle generated message and it's telling you rather clearly that your procedure cannot be found.
--- Cause: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00221: 'GET_KEY_2' is not a procedure or is undefined
ORA-06550: line 1, column 7:
 
One thing that I would suggest is that while the procedure might exist within your schema it might not be valid, meaning that it might contain errors. Please look to see if the procedure has errors. If it does then Oracle will tell you that it does not exist and that is because it is not valid.
 
There are only a few possibilities here:


The procedure does not exist
The procedure exists but is not contained within the package/schema that you are specifying.
The procedure exists but is invalid due to compilation errors.

This is clearly not a problem with iBatis or with the way that the procedure is being call. This is simply an issue within the Oracle schema that you are using.

 
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, October 03, 2006 3:56 AM
To: user-java@ibatis.apache.org
Subject: Re: Stored procedures (package functions) returning a row

The log generated by log4j confirms that the PreparedStatement is correctly prepared

DEBUG [main] - Created connection 22664464.
DEBUG [main] - {conn-10} Connection
DEBUG [main] - {pstm-11} PreparedStatement: {call ut_Tipo_Dato.ut_setup}
DEBUG [main] - {pstm-11} Parameters: []
DEBUG [main] - {pstm-11} Types: []
DEBUG [main] - Returned connection 22664464 to pool.
DEBUG [main] - Checked out connection 22664464 from pool.
DEBUG [main] - {conn-12} Connection
DEBUG [main] - {pstm-13} PreparedStatement: {call ut_Tipo_dato.get_key_2}
DEBUG [main] - {pstm-13} Parameters: []
DEBUG [main] - {pstm-13} Types: []
DEBUG [main] - Returned connection 22664464 to pool.
com.ibatis.common.jdbc.exception.NestedSQLException: 
--- The error occurred in it/finmatica/gpj/aa/frontebd/DizionarioTipiDatoTest.xml. 
--- The error occurred while applying a parameter map. 
--- Check the get_key_2-InlineParameterMap. 
--- Check the statement (update procedure failed). 
--- Cause: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00221: 'GET_KEY_2' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

Caused by: java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00221: 'GET_KEY_2' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:185)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
[...]


Something is wrong on the stored code? It wouldn't seem A mini test harness written on-th-gfly runs correctly.
The Oracle diagnostic does not mention 'UT_TIPO_DATO.GET_KEY_2' (instead it 

Re: Stored procedures (package functions) returning a row

2006-10-03 Thread C . Zecca

[EMAIL PROTECTED] scritti il 03/10/2006 15:26:03

 Jeff Butler [EMAIL PROTECTED] scritti il 03/10/2006 14:59:55
 
  There are two different issues here.
 
 [...] 
  
  2. Only use queryForObject if the function returns a result set. If
  it is just returning a single value, then call it with syntax like this:
  
  {? = call myFunction}
  
  Register an output parameter - not a resultMap - then call it with 
  the update method.

[...]

The Developer guide reports, about update() that

These methods are specifically meant for update statements (a.k.a. non-query).
That said, it’s not impossible to execute an update statement using one of the query methods below,
however this is an odd semantic and obviously driver dependent.

Its signature

public int update(String statementName, Object parameterObject)
throws SQLException

clearly indicates that is NOT possible to get any row via return value.
The only way might be via the Object parameterObject.

 I hope that it's possible to get, via output parameters, not only 
 simple SQL types but record types (rows) as well.

There are some topics and related post about output parameters in the mailing list
and calls of the form

{ ? = call functionName }

This one
http://www.mail-archive.com/user-java@ibatis.apache.org/msg00998.html
reports uses of the queryForObject (I guess that a result set is handled via a Map)
not of the update method()

Furthermore, the definition fo the result is mapped onto a simple SQL type

parameterMap id=getStringParameterMap class=java.util.Map
parameter property=result jdbcType=VARCHAR 
javaType=java.lang.String mode=OUT /



Re: Automatic rollback with Spring for junit tests ? SOLUTION :-)

2006-10-03 Thread Jerome Gagner

Just use AbstractTransactionalDatabaseTestCase or whatever it's
called. Works great for me. That may not be what it's called, springs
site is down right now and I can't look up the exact answer.


HTH

-Jerome

On 10/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:





Hi there!



I was struggling with this problem, then I finally realized the problem, ME
J



I have been using Hibernate with Spring (someone else has setup the
transactionManager stuff), and when
 I realized what I was actually missing… then wola J This line here in the
spring-dao.xml file of course J



bean id=transactionManager
class=org.springframework.jdbc.datasource.DataSourceTransactionManager

property name=dataSource

ref bean=dataSource/

/property

/bean



But are other better ways to do it ?



--



Anyway nice Ibatis/Spring links:



http://www.learntechnology.net/struts-spring-ibatis.do
(The example I was using, but they didn't have the transactionManager setup)



Reading this I figured it all out J



http://www.springframework.org/docs/reference/orm.html#orm-ibatis





Take care,

Erlend




got sql exception:

2006-10-03 Thread Ying . Li

All,

I got following sql exception during
queryforlist. We are using oracle 10g. with ojdbc14.jar. Thanks
for any suggestion or clue.


ERROR|03 Oct 2006 21:05:14,058|b_Worker-4|b.batch.ErrorRecordReProcessor|Caught
Exception during procesCommunicationErrorRecords:Failed to queryForList
- id [selectCommunicationRecords], parameterObject [{processId=3, rows=100,
recordSeqNbr=1}]. Cause: com.ibatis.common.jdbc.exception.NestedSQLException:
 
--- The error occurred in com/equifax/authentication/ehub/configuration/ehub_batch_sql_statements.xml.

--- The error occurred while applying a parameter map. 
--- Check the selectCommunicationRecords-InlineParameterMap. 
--- Check the statement (query failed). 
--- Cause: java.sql.SQLException: ORA-00600: internal error code, arguments:
[qerpfAllocateR], [], [], [], [], [], [], []

Caused by: java.sql.SQLException: ORA-00600: internal error code, arguments:
[qerpfAllocateR], [], [], [], [], [], [], []
|
com.ibatis.dao.client.DaoException: Failed to queryForList - id [selectCommunicationRecords],
parameterObject [{processId=3, rows=100, recordSeqNbr=1}]. Cause:
com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in com/equifax/authentication/ehub/configuration/ehub_batch_sql_statements.xml.

--- The error occurred while applying a parameter map. 
--- Check the selectCommunicationRecords-InlineParameterMap. 
--- Check the statement (query failed). 
--- Cause: java.sql.SQLException: ORA-00600: internal error code, arguments:
[qerpfAllocateR], [], [], [], [], [], [], []

Caused by: java.sql.SQLException: ORA-00600: internal error code, arguments:
[qerpfAllocateR], [], [], [], [], [], [], []

Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: 

--- The error occurred in com/equifax/authentication/ehub/configuration/ehub_batch_sql_statements.xml.

--- The error occurred while applying a parameter map. 
--- Check the selectCommunicationRecords-InlineParameterMap. 
--- Check the statement (query failed). 
--- Cause: java.sql.SQLException: ORA-00600: internal error code, arguments:
[qerpfAllocateR], [], [], [], [], [], [], []

Caused by: java.sql.SQLException: ORA-00600: internal error code, arguments:
[qerpfAllocateR], [], [], [], [], [], [], []


at com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoTemplate.java:205)

at com.equifax.authentication.ehub.persistence.batch.BatchSqlMapDao.getCommunicationErrorRecords(BatchSqlMapDao.java:413)

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 com.ibatis.dao.engine.impl.DaoProxy.invoke(DaoProxy.java:72)

at $Proxy16.getCommunicationErrorRecords(Unknown Source)

at com.equifax.authentication.ehub.batch.ErrorRecordReProcessor.retrieveCommunicationErrorRecords(ErrorRecordReProcessor.java:212)

at com.equifax.authentication.ehub.batch.ErrorRecordReProcessor.processCommunicationErrorRecords(ErrorRecordReProcessor.java:157)

at com.equifax.authentication.ehub.batch.ErrorRecordReProcessor.process(ErrorRecordReProcessor.java:86)

at com.equifax.authentication.ehub.batch.impl.BatchFileProcessHandlerImpl.process(BatchFileProcessHandlerImpl.java:125)

at com.equifax.authentication.ehub.job.BatchInputProcessJob.performJob(BatchInputProcessJob.java:120)

at com.equifax.scheduler.JobBase.execute(JobBase.java:68)

at org.quartz.core.JobRunShell.run(JobRunShell.java:203)

at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520