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

Allow specifying columnPrefix in constructor mapping. #1318

Merged
merged 2 commits into from Jul 29, 2018

Conversation

harawata
Copy link
Member

It's used with resultMap (see the attached test).

<resultMap id="authorRM" type="Author">
  <id property="id" column="id" />
  <result property="name" column="name" />
</resultMap>

<resultMap id="articleRM" type="Article">
  <constructor>
    <idArg column="id" javaType="int" />
    <arg column="name" javaType="string" />
    <arg resultMap="authorRM" columnPrefix="author_" javaType="Author" />
    <arg resultMap="authorRM" columnPrefix="coauthor_" javaType="Author" />
  </constructor>
</resultMap>

This should fix #968 .

@kazuki43zoo , @h3adache ,
Please let me know if there is any concern.

@kazuki43zoo
Copy link
Member

@harawata I think it's good.
But I have one question. Is not need adding columnPrefix attribute on @Arg annotation ?

@harawata
Copy link
Member Author

Damn...you noticed! XD
I'll update the PR.

@kazuki43zoo
Copy link
Member

👍

@harawata harawata merged commit f31526d into mybatis:master Jul 29, 2018
@harawata
Copy link
Member Author

Thank you, @kazuki43zoo !

@h3adache
Copy link
Member

Thanks @harawata! this is really useful!

harawata added a commit to mybatis/mybatis.github.io that referenced this pull request Dec 5, 2018
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request Dec 9, 2018
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
Allow specifying `columnPrefix` in constructor mapping.
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
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

Successfully merging this pull request may close these issues.

Constructor Args do not support columnPrefix
3 participants