My favorites | Sign in
Project Home Downloads Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 687: Use parameter names without explicit @Param
3 people starred this issue and may be notified of changes. Back to list
Status:  Invalid
Owner:  eduardo.macarron
Closed:  Oct 2012


Sign in to add a comment
 
Reported by NoSuchL...@gmail.com, Oct 8, 2012
What version of the MyBatis are you using?

3.1.1

Please describe the problem.  Unit tests are best!

Currently, we have to do something like:

@Insert("INSERT INTO A(X, Y) VALUES(#{x}, #{y})")
void insertSomething(@Param("x") long x, @Param("y") String y);

Or else fall back to ordinal parameters. Why can't we just default to the actual parameter name and do this?

void insertSomething(long x, String y);

Spring's @RequestParam does the same thing (cf. http://stackoverflow.com/questions/6891539) by accessing the so-called debug information, which nowadays is usually compiled in (and if anyone chooses not to, the existing @Param way is still available). 
Oct 23, 2012
#2 me...@rewor.cz
I'm afraid this won't be possible. 
The name is stored in LocalVariableTable which is part of method's Code attribute - but abstract methods (=interface methods) must not have this attribute (they have no code; jvms 4.7.3).
Oct 28, 2012
Project Member #3 eduardo.macarron
What a pitty. Thanks both for the reseach.
Status: Invalid
Owner: eduardo.macarron
Sign in to add a comment

Powered by Google Project Hosting