Recursion problem leads to StackOverflow

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Recursion problem leads to StackOverflow

Daniel Stieger
Hi,

i have an object - let s assume Car :) - which looks like this:
- id
- association to a radio   (numeric foreign key)
- association to a car (numeric foreign key)

The car association in Car is mapped like this ...
<association property="car" jdbcType="NUMERIC"
javaType="AssociationTest.Car" column="CAR_3"
resultMap="AssociationTest.CarResultMap"
select="AssociationTest.CarRefSelect"></association>


So i tried to set radio to null, save it and read it again - that
works perfect. But if i set car to null, i get a recursion somewhere
in mybatis ... did i configure it wrong?

That s the trace when reading back the saved car (where car = null)
with a select statement ...

Exception in thread "main" java.lang.StackOverflowError
        at java.util.HashMap.get(HashMap.java:300)
        at
java.util.PropertyResourceBundle.handleGetObject(PropertyResourceBundle.java:
138)
        at java.util.ResourceBundle.getObject(ResourceBundle.java:368)
        at java.util.ResourceBundle.getString(ResourceBundle.java:334)
        at oracle.jdbc.driver.Message11.msg(Message11.java:61)
        at oracle.jdbc.driver.DatabaseError.findMessage(DatabaseError.java:
579)
        at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:
143)
        at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:
208)
        at
oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:
3319)
        at
oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:
1926)
        at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:
1563)
        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.ibatis.logging.jdbc.ResultSetLogger.invoke(ResultSetLogger.java:
31)
        at $Proxy9.getInt(Unknown Source)
        at
org.apache.ibatis.type.IntegerTypeHandler.getNullableResult(IntegerTypeHandler.java:
17)
        at
org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:
29)
        at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.createRowKeyForMappedProperties(NestedResultSetHandler.java:
219)
        at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.createRowKey(NestedResultSetHandler.java:
196)
        at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.applyNestedResultMappings(NestedResultSetHandler.java:
121)
        at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.getRowValue(NestedResultSetHandler.java:
96)
        at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.applyNestedResultMappings(NestedResultSetHandler.java:
125)
        at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.getRowValue(NestedResultSetHandler.java:
96)
        at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.applyNestedResultMappings(NestedResultSetHandler.java:
125)
        at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.getRowValue(NestedResultSetHandler.java:
96)
        at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.applyNestedResultMappings(NestedResultSetHandler.java:
125)
        at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.getRowValue(NestedResultSetHandler.java:
96)
Reply | Threaded
Open this post in threaded view
|

Re: Recursion problem leads to StackOverflow

Clinton Begin
Administrator
I'm working from memory here... but I think you should get rid of the resultMap attribute.  Just use the select Attribute.  

Clinton

On Tue, Jun 28, 2011 at 8:46 AM, Daniel Stieger <[hidden email]> wrote:
Hi,

i have an object - let s assume Car :) - which looks like this:
- id
- association to a radio   (numeric foreign key)
- association to a car (numeric foreign key)

The car association in Car is mapped like this ...
<association property="car" jdbcType="NUMERIC"
javaType="AssociationTest.Car" column="CAR_3"
resultMap="AssociationTest.CarResultMap"
select="AssociationTest.CarRefSelect"></association>


So i tried to set radio to null, save it and read it again - that
works perfect. But if i set car to null, i get a recursion somewhere
in mybatis ... did i configure it wrong?

That s the trace when reading back the saved car (where car = null)
with a select statement ...

Exception in thread "main" java.lang.StackOverflowError
       at java.util.HashMap.get(HashMap.java:300)
       at
java.util.PropertyResourceBundle.handleGetObject(PropertyResourceBundle.java:
138)
       at java.util.ResourceBundle.getObject(ResourceBundle.java:368)
       at java.util.ResourceBundle.getString(ResourceBundle.java:334)
       at oracle.jdbc.driver.Message11.msg(Message11.java:61)
       at oracle.jdbc.driver.DatabaseError.findMessage(DatabaseError.java:
579)
       at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:
143)
       at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:
208)
       at
oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:
3319)
       at
oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:
1926)
       at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:
1563)
       at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
       at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at
org.apache.ibatis.logging.jdbc.ResultSetLogger.invoke(ResultSetLogger.java:
31)
       at $Proxy9.getInt(Unknown Source)
       at
org.apache.ibatis.type.IntegerTypeHandler.getNullableResult(IntegerTypeHandler.java:
17)
       at
org.apache.ibatis.type.BaseTypeHandler.getResult(BaseTypeHandler.java:
29)
       at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.createRowKeyForMappedProperties(NestedResultSetHandler.java:
219)
       at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.createRowKey(NestedResultSetHandler.java:
196)
       at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.applyNestedResultMappings(NestedResultSetHandler.java:
121)
       at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.getRowValue(NestedResultSetHandler.java:
96)
       at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.applyNestedResultMappings(NestedResultSetHandler.java:
125)
       at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.getRowValue(NestedResultSetHandler.java:
96)
       at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.applyNestedResultMappings(NestedResultSetHandler.java:
125)
       at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.getRowValue(NestedResultSetHandler.java:
96)
       at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.applyNestedResultMappings(NestedResultSetHandler.java:
125)
       at
org.apache.ibatis.executor.resultset.NestedResultSetHandler.getRowValue(NestedResultSetHandler.java:
96)