Hi everybody,

I was wondering if anybody would answer my question, but I've finally fixed my problem by myself. :-)
So if it can help, here's the story :

In a DB table, there is a field of type LONG (it should be the same with a LONG RAW). In my XML sql-map file, I've defined 2 request, one based on the primary key, the second on another key.

What happen is the first request works fine and the second throws an exception, saying :

"com.ibatis.dao.client.DaoException: Failed to queryForList - id [getInterventionByPrestation], parameterObject [EMAIL PROTECTED] Cause: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/bv/sgo/persistance/affaire/mapping/Intervention.xml. --- The error occurred while applying a result map. --- Check the Intervention.intervention-result. --- Check the result mapping for the 'note' property. --- Cause: java.sql.SQLException: Le flux de données est déjà fermé
Caused by: java.sql.SQLException: Le flux de données est déjà fermé
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/bv/sgo/persistance/affaire/mapping/Intervention.xml. --- The error occurred while applying a result map. --- Check the Intervention.intervention-result. --- Check the result mapping for the 'note' property. --- Cause: java.sql.SQLException: Le flux de données est déjà fermé
Caused by: java.sql.SQLException: Le flux de données est déjà fermé
at com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForList(SqlMapDaoTemplate.java:205) at com.bv.sgo.persistance.affaire.impl.InterventionMapDAO.getInterventionsParPrestation(InterventionMapDAO.java:59)
   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:324)
   at com.ibatis.dao.engine.impl.DaoProxy.invoke(DaoProxy.java:72)
   at $Proxy78.getInterventionsParPrestation(Unknown Source)
at com.bv.sgo.service.affaire.ServiceIntervention.getLesInterventionByPrestation(ServiceIntervention.java:65) at com.bv.sgo.service.affaire.ServiceInterventionTest.testGetLesInterventionByPrestation(ServiceInterventionTest.java:40)
   at [....]"

The french part is the equivalent of : "Stream has already been closed"

The solution was found by reading the page : http://www.cis.upenn.edu/~cis550/TRASH/JDBC_doc/jdbcoc10.htm that says :
"Stream has already been closed
If you fetch LONG or LONG RAW data in the wrong order you can get the SQL Exception "Stream has already been closed". See Streams Tutorial for more information."

So I've put the LONG field in the last place in the list of fields of my query and it works ! But what I don't know is what happen if there is 2 LONG fields in the table. I think that iBatis developpers should be aware of this issue and try and find a elegant solution to it.

I hope my experience will help anybody encountering the same issue.
Regards,

--
Vincent NICOLAS.
Lyon, France.

Reply via email to