how to add custom property to resultMap' result tag?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

how to add custom property to resultMap' result tag?

Lianghua Yu
resultMap' result tag have `property/column/javaType/jdbcType/typeHandler`  properties,now I want to add `remark` property in to result tag, and how to  parse it in java code? like this:

```
<resultMap id="authorResult" type="Author">
  <id property="id" column="author_id" remark="userId"/>
  <result property="username" column="author_username" remark="userLoginName"/>
  <result property="password" column="author_password" remark="userLoginPwd"/>
  <result property="email" column="author_email" remark="userEmail"/>
</resultMap>
```

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/1c2ef934-3e20-497c-b41f-2a3b9672eeae%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: how to add custom property to resultMap' result tag?

Iwao AVE!
Hello,

Parsing result map is an internal process and it is not possible to add custom attribute.
What are you trying to achieve by adding 'remark'?

Regards,
Iwao

On Sat, Feb 29, 2020 at 12:48 PM Lianghua Yu <[hidden email]> wrote:
resultMap' result tag have `property/column/javaType/jdbcType/typeHandler`  properties,now I want to add `remark` property in to result tag, and how to  parse it in java code? like this:

```
<resultMap id="authorResult" type="Author">
  <id property="id" column="author_id" remark="userId"/>
  <result property="username" column="author_username" remark="userLoginName"/>
  <result property="password" column="author_password" remark="userLoginPwd"/>
  <result property="email" column="author_email" remark="userEmail"/>
</resultMap>
```

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/1c2ef934-3e20-497c-b41f-2a3b9672eeae%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CA%2Buep2RNAVBWDAq-BZz9cu-btxArG4zaxwQ41by8xvvGVZuyDw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: how to add custom property to resultMap' result tag?

Lianghua Yu
Thanks for you reply, I want to add a describe attribute for column. 

在 2020年3月1日星期日 UTC+8下午6:45:34,Iwao AVE!写道:
Hello,

Parsing result map is an internal process and it is not possible to add custom attribute.
What are you trying to achieve by adding 'remark'?

Regards,
Iwao

On Sat, Feb 29, 2020 at 12:48 PM Lianghua Yu <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="RDbOE-X3CAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">aaq...@...> wrote:
resultMap' result tag have `property/column/javaType/jdbcType/typeHandler`  properties,now I want to add `remark` property in to result tag, and how to  parse it in java code? like this:

```
<resultMap id="authorResult" type="Author">
  <id property="id" column="author_id" remark="userId"/>
  <result property="username" column="author_username" remark="userLoginName"/>
  <result property="password" column="author_password" remark="userLoginPwd"/>
  <result property="email" column="author_email" remark="userEmail"/>
</resultMap>
```

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="RDbOE-X3CAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybati...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/mybatis-user/1c2ef934-3e20-497c-b41f-2a3b9672eeae%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/mybatis-user/1c2ef934-3e20-497c-b41f-2a3b9672eeae%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/mybatis-user/1c2ef934-3e20-497c-b41f-2a3b9672eeae%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/mybatis-user/1c2ef934-3e20-497c-b41f-2a3b9672eeae%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/02eba3b2-cb71-445f-9362-a004409fe61d%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: how to add custom property to resultMap' result tag?

Iwao AVE!
I'm sorry, but I am not sure what you mean by 'add describe attribute for column'.
Please post some concrete example (code, SQL, etc.).

Regards,
Iwao

On Sun, Mar 1, 2020 at 7:56 PM Lianghua Yu <[hidden email]> wrote:
Thanks for you reply, I want to add a describe attribute for column. 

在 2020年3月1日星期日 UTC+8下午6:45:34,Iwao AVE!写道:
Hello,

Parsing result map is an internal process and it is not possible to add custom attribute.
What are you trying to achieve by adding 'remark'?

Regards,
Iwao

On Sat, Feb 29, 2020 at 12:48 PM Lianghua Yu <[hidden email]> wrote:
resultMap' result tag have `property/column/javaType/jdbcType/typeHandler`  properties,now I want to add `remark` property in to result tag, and how to  parse it in java code? like this:

```
<resultMap id="authorResult" type="Author">
  <id property="id" column="author_id" remark="userId"/>
  <result property="username" column="author_username" remark="userLoginName"/>
  <result property="password" column="author_password" remark="userLoginPwd"/>
  <result property="email" column="author_email" remark="userEmail"/>
</resultMap>
```

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/1c2ef934-3e20-497c-b41f-2a3b9672eeae%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/02eba3b2-cb71-445f-9362-a004409fe61d%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CA%2Buep2Tp%3DHY6OKc0ToO1rLWcpPS3WnkMLZxSTZ_xgjFP6tmAOQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re[2]: how to add custom property to resultMap' result tag?

Guy Rouillier-2
Iwao, I'm guessing Lianghua is referring to a "remarks" column in the catalog table describing columns.  For example, MySQL has INFORMATION_SCHEMA.COLUMNS.column_comment, while DB2 has SYSIBM.SYSCOLUMNS.remarks.  If my guess is correct, Lianghua will not be able to use this in any way he seems to desire.  Foremost, system catalog tables are not updateable.  Secondly, INFORMATION_SCHEMA is not uniformly implemented across vendors.  For example, PostgreSQL does not have a remarks column in their INFORMATION_SCHEMA.  

Lianghua, do you want to persist these remarks into the database, or just use them during the execution of your program?  Either way, I think this is something you are going to have to address on your own.  As Iwao said in an earlier reply, processing of a resultMap is an internal process.

--
Guy Rouillier

On 3/1/2020 9:15:27 AM, "Iwao AVE!" <[hidden email]> wrote:

I'm sorry, but I am not sure what you mean by 'add describe attribute for column'.
Please post some concrete example (code, SQL, etc.).

Regards,
Iwao

On Sun, Mar 1, 2020 at 7:56 PM Lianghua Yu <[hidden email]> wrote:
Thanks for you reply, I want to add a describe attribute for column. 

在 2020年3月1日星期日 UTC+8下午6:45:34,Iwao AVE!写道:
Hello,

Parsing result map is an internal process and it is not possible to add custom attribute.
What are you trying to achieve by adding 'remark'?

Regards,
Iwao

On Sat, Feb 29, 2020 at 12:48 PM Lianghua Yu <[hidden email]> wrote:
resultMap' result tag have `property/column/javaType/jdbcType/typeHandler`  properties,now I want to add `remark` property in to result tag, and how to  parse it in java code? like this:

```
<resultMap id="authorResult" type="Author">
  <id property="id" column="author_id" remark="userId"/>
  <result property="username" column="author_username" remark="userLoginName"/>
  <result property="password" column="author_password" remark="userLoginPwd"/>
  <result property="email" column="author_email" remark="userEmail"/>
</resultMap>
```

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/1c2ef934-3e20-497c-b41f-2a3b9672eeae%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/02eba3b2-cb71-445f-9362-a004409fe61d%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CA%2Buep2Tp%3DHY6OKc0ToO1rLWcpPS3WnkMLZxSTZ_xgjFP6tmAOQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/em1cb8e1df-ab0c-466e-ab52-4430ed8aeb62%40asus.