New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyBatis 3.2.6 not work annotation @One #167

Closed
alexey-su opened this Issue Mar 29, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@alexey-su
Contributor

alexey-su commented Mar 29, 2014

MyBatis 3.2.6. Always generates an error

@Result(property="org", column="ORG_ID", javaType=OrgEntity.class,
   one=@One(select="myapp.mapper.OrgMapper.selectOrg")),

org.apache.ibatis.builder.BuilderException: Cannot use both @one and @Many annotations in the same @Result
at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.hasNestedSelect(MapperAnnotationBuilder.java:522)

in code

private boolean hasNestedSelect(Result result) {
  boolean hasNestedSelect = result.one().select().length() > 0;
  if (hasNestedSelect) {
    throw new BuilderException("Cannot use both @One and @Many annotations in the same @Result");

It would be very useful to extend the functional annotation @one and @Many

cange from

@One(select="myapp.mapper.OrgMapper.selectOrg")

to

@One(select="selectOrg", mapper=OrgMapper.class)

@emacarron emacarron added this to the 3.2.7 milestone Mar 29, 2014

@emacarron emacarron added the bug label Mar 29, 2014

@emacarron emacarron self-assigned this Mar 29, 2014

@emacarron

This comment has been minimized.

Show comment
Hide comment
@emacarron

emacarron Mar 29, 2014

Member

Thanks for the report. It is a bug indeed. Looks that that code is not covered in any test.

Member

emacarron commented Mar 29, 2014

Thanks for the report. It is a bug indeed. Looks that that code is not covered in any test.

@emacarron emacarron closed this in 5c239b5 Mar 29, 2014

emacarron added a commit that referenced this issue Apr 2, 2014

qlp added a commit to qlp/mybatis-3 that referenced this issue Jun 18, 2014

qlp added a commit to qlp/mybatis-3 that referenced this issue Jun 18, 2014

hazendaz added a commit to hazendaz/mybatis-3 that referenced this issue Jul 12, 2014

hazendaz added a commit to hazendaz/mybatis-3 that referenced this issue Jul 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment