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

Extended mapper cannot get result map from parent #174

Closed
themez opened this issue Apr 3, 2014 · 5 comments
Closed

Extended mapper cannot get result map from parent #174

themez opened this issue Apr 3, 2014 · 5 comments

Comments

@themez
Copy link

themez commented Apr 3, 2014

interface Parent { 
@Select
@ResultMap("BaseResultMap")
Foo selectByPrimaryKey(String id);
} 

interface Child extends Parent { 

} 

when call Child.selectByPrimaryKey. It will throw an exception:

java.lang.IllegalArgumentException: Result Maps collection does not contain value for Child.BaseResultMap

I've looked into MapperBuilderAssistant

  private void setStatementResultMap(
      String resultMap,
      Class<?> resultType,
      ResultSetType resultSetType,
      MappedStatement.Builder statementBuilder) {
    resultMap = applyCurrentNamespace(resultMap, true);
    ...
 }

maybe we can do similar modification as #35 ,
If not found in child namespace, then try to search in parent namespace?

@ilkomiliev
Copy link

Any progress here? I have the same problem using the a.m. "generic DAO" pattern - or is there a workaround? Any help will be highly appreciated!

@ilkomiliev
Copy link

As far as I can see may be we can walk the class hierarchy up to method.getDecalredClass and get the first found mapped statement, if any?

@ilkomiliev
Copy link

sorry for the comments above - I was refering to #35

@harawata
Copy link
Member

Thank you for the suggestion, @themez !

But...
Unlike #35 , @ResultMap is used to reference a result map, not to define one.
If we did implement this, we may have to perform the same namespace-completion on other places like select attribute of @One or @Many.

And even without this, all you have to do is to specify the result map ID with its namespace, so it does not seem to be worth it.
Wouldn't you agree?

Regards,
Iwao

@themez
Copy link
Author

themez commented Feb 26, 2016

Thanks for clarification @harawata ! I think is reasonable.

@themez themez closed this as completed Feb 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants