Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Mappers should support polymorphic method invocations #231

Closed
GoogleCodeExporter opened this issue Apr 21, 2015 · 4 comments
Closed

Mappers should support polymorphic method invocations #231

GoogleCodeExporter opened this issue Apr 21, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What version of the MyBatis are you using?
3.0.4

Please describe the problem.  Unit tests are best!
Given this Mapper:

  interface CompanyMapper
  {
    @Delete("DELETE FROM companies_employees WHERE
      company_id=#{company.id} AND employee_id=#{employee.id}")
    remove(Company company, Employee employee);

    @Delete("DELETE FROM company WHERE id=#{id}")
    remove(Company company);
  }

I get: "Mapped Statements collection already contains value for
CompanyMapper.remove"

What is the expected output? What do you see instead?
Polymorphic mapper methods should be supported. Instead of mapping both methods 
to "remove" they could be mapped to "remove(Company, Employee)" and 
"remove(Company)" accordingly which would remain consistent with the XML 
configuration.

Original issue reported on code.google.com by cowwoc...@gmail.com on 17 Jan 2011 at 2:16

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

I did a fast test with hessian mangling algorithm (patch attached) and I think 
this is not a good idea.

The main problem with mangling is that statement names may became really 
complex and this will generate human errors. This is not the idea of this tool 
but to be simple.

I will let my test attached just in case anyone wants to follow with this 
change.  

Original comment by eduardo.macarron on 5 Feb 2012 at 6:04

  • Changed state: WontFix

Attachments:

@GoogleCodeExporter
Copy link
Author

Issue 738 has been merged into this issue.

Original comment by eduardo.macarron on 13 Dec 2012 at 5:22

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant