mybatis / mybatipse

Eclipse plugin adding support for MyBatis SQL Mapper Framework.
Eclipse Public License 1.0
333 stars 91 forks source link

JPA ResultMap parsing #94

Open kenjdavidson opened 5 years ago

kenjdavidson commented 5 years ago

Hey, this is more of an request than a bug. I'm also done most of it in a fork so I'm not sure if you want me to clean that up and then pull request or if you want to look into it. But essentially I didn't have a 1:1 with column names, so I decided to implement some JPA annotation reading during the processing of the result map items:

@Entity
@Table(name="table1")
public class Table {
   @Id
   @Column(name_"the_id")
   private long id;

   @Column(name="tbl_name")
    private String tableName
}

into:

<resultMap ...>
    <id property="id" column="the_id" />
    <result property="tableName" column="tbl_name" />
    ...
</resultMap>

It needs to be cleaned up in terms of:

but for the most part it's been working well to speed up my conversion. Let me know if its worth while to you, if not, I'll just keep maintaining it.

harawata commented 5 years ago

Hi @kenjdavidson ,

Assisting migration from JPA sounds like an interesting idea. Please send us a PR when you have some spare time. Thanks in advance!