Skip to content
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
Closed

MyBatis 3.2.6 not work annotation @One #167

alexey-su opened this issue Mar 29, 2014 · 1 comment
Assignees
Labels
Milestone

Comments

@alexey-su
Copy link
Contributor

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
Copy link
Member

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

emacarron added a commit that referenced this issue Apr 2, 2014
hazendaz referenced this issue in hazendaz/mybatis-3 Jul 12, 2014
hazendaz referenced this issue in hazendaz/mybatis-3 Jul 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants