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

Add ability of @ResultMap to take a class #774

Open
GoogleCodeExporter opened this issue Apr 21, 2015 · 6 comments
Open

Add ability of @ResultMap to take a class #774

GoogleCodeExporter opened this issue Apr 21, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

MyBatis Version: 3.1.1

I currently have xml resultmaps and use the @ResultMap annotaion in my mapper 
interfaces. I would like to request the ability to inject a class into 
@ResultMap. I would also like to request annotaions that can be added to the 
fields of a class to denote what coloumns go with that field, and an annotaion 
for complex feilds that basically defined them as an association.

This would be great and completely elimiate my mapper xml files.

Example:
Mapper Interface...

@Select("SELECT * FROM LOG)
@ResultMap(Log.class)
List<Log> selectAllLogs();

...End Mapper Interface

Log Class...

public class Log{
  @ResultColumn("DATE")
  private String date;

  @ResultColumn("TIME")
  privte String time;

  @ResultAssociation()
  private User user;

}

User Class...

public class User {

  @ResultColumn("FIRST_NAME")
  private String firstName;

  @ResultCoulmn("LAST_NAME")
  private String lastName;
}

I hope my example helps to clarify my request.

Thanks,
Patrick Wiltrout

Original issue reported on code.google.com by patrick....@gmail.com on 14 Feb 2013 at 3:14

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