emacarron / mybatis

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

RowBounds with nested one-to-one associations fail #129

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the MyBatis are you using?
3.0.2

Please describe the problem.  Unit tests are best!
The selectList() method fails with a valid RowBounds (to limit data) when using 
a result map that contains an <association> to implement a 1-to-1 relationship.

What is the expected output? What do you see instead?
I can understand why RowBounds are illegal with a one-to-many <collection>, 
however I'm not sure why this is a problem for a 1-to-1 association. Maybe this 
is by design and I'm missing something?

The exact exception received is:
Caused by: org.apache.ibatis.executor.ExecutorException: Mapped Statements with 
nested result mappings cannot be safely constrained by RowBounds.
    at org.apache.ibatis.executor.resultset.NestedResultSetHandler.ensureNoRowBounds(NestedResultSetHandler.java:41)

Please provide any additional information below.

Original issue reported on code.google.com by posth...@gmail.com on 5 Oct 2010 at 9:51

GoogleCodeExporter commented 9 years ago
I'd like to be able to constrain the number of rows returned using RowBounds 
with selectList() for 1-to-1 <association> too.  I must be missing the same 
thing as posthour.

Even for 1-to-many <collection>s, I can't see why the use of RowBounds is 
unsafe.  Sure, the number of Objects returned will be fewer than the number of 
rows in the query result (depending on the parent-child cardinality), but there 
may still be scenarios where it is useful to constrain the amount of data 
returned.

Original comment by jeffne...@hotmail.com on 10 Oct 2010 at 2:28

GoogleCodeExporter commented 9 years ago
I also find this problem

Original comment by wjk...@163.com on 6 Dec 2010 at 10:26

GoogleCodeExporter commented 9 years ago
I agree with Jeff that it is useful to use RowBounds for 1-to-many 
<collection>s in addition to 1-to-1 <association>s. We specifically relied on 
this capability in iBatis 2.x and not having it is a major problem for us 
(especially for associations). Please apply the attached patch to remove this 
limitation for associations and collections.

Original comment by patrick....@3pillarglobal.com on 21 Jan 2011 at 9:33

Attachments:

GoogleCodeExporter commented 9 years ago
Is there any newsupdate about this one ?
Will it be fixed, is it ment to be that way ?

Original comment by bru...@gmail.com on 9 Mar 2011 at 9:48

GoogleCodeExporter commented 9 years ago
Could the priority of this be bumped up?  I'm curious how most people are 
handling 1-to-1 result-sets where paging and joins for additional data are 
needed.  Obviously additional queries are one option, but it seems the most 
efficient and clean way of handling it is to remove this limitation from 
MyBatis (which I have done as per above patch).  Are there any other reasons 
why this "ensureNoRowBounds" method would be in place?

Original comment by skel...@gmail.com on 8 Sep 2011 at 3:12

GoogleCodeExporter commented 9 years ago
Have a look at r3897. A new config property safeRowBoundsEnabled enables 
bypassing the ensureNoRowBounds() method.

Original comment by eduardo.macarron on 8 Sep 2011 at 6:37

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 3 Mar 2012 at 9:11

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 3 Mar 2012 at 9:39