Feature request of add exception tag in xml

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

Feature request of add exception tag in xml

葛俊
Hi Mybatis Contributors.

I'm thinking of add exception tag to mybatis xml fragment like following.

<a imageanchor="1" href="about:invalid#zClosurez" style="clear: left; margin-bottom: 1em; float: left; margin-right: 1em;">Snipaste_2019-10-18_11-15-45.png






















When sometime we want to throw exception from sql when some condition can't match.

I know it can be done from java code, but it may be more straightforward if we use it in sql.

we could throw an runtimeException with the message like MybatisCoditionNotMatchException.

how do you think of it.  please share your opinion. If most approve it, I can make a pull request for it.


Thanks.


--
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/7a6eea2b-b9f1-4bc4-ab98-c8ac0abd7e16%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Feature request of add exception tag in xml

Ray Sprinkle
I think that argument validation belongs in the Java code.  Using default methods you could even add the test to the mapper interface.

On Thu, Oct 17, 2019, 11:25 PM 葛俊 <[hidden email]> wrote:
Hi Mybatis Contributors.

I'm thinking of add exception tag to mybatis xml fragment like following.

Snipaste_2019-10-18_11-15-45.png






















When sometime we want to throw exception from sql when some condition can't match.

I know it can be done from java code, but it may be more straightforward if we use it in sql.

we could throw an runtimeException with the message like MybatisCoditionNotMatchException.

how do you think of it.  please share your opinion. If most approve it, I can make a pull request for it.


Thanks.


--
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/7a6eea2b-b9f1-4bc4-ab98-c8ac0abd7e16%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/CALhVUhyZK%3DVBAcKz3eySiXGQY2WxxbaJ2Fmw1rVCODqSAPZoHg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Feature request of add exception tag in xml

葛俊
Thanks rds.

Using default method can solve the problem for if test statement.

For choose when statement, using exception tag may help for less code in java like following.

<a imageanchor="1" href="about:invalid#zClosurez" style="clear: left; margin-bottom: 1em; float: left; margin-right: 1em;">Snipaste_2019-10-21_08-55-33.png




















Thanks.






On Friday, October 18, 2019 at 6:28:41 PM UTC+8, rds wrote:
I think that argument validation belongs in the Java code.  Using default methods you could even add the test to the mapper interface.

On Thu, Oct 17, 2019, 11:25 PM 葛俊 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="LHmqK8i3DwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">gejun...@...> wrote:
Hi Mybatis Contributors.

I'm thinking of add exception tag to mybatis xml fragment like following.

Snipaste_2019-10-18_11-15-45.png






















When sometime we want to throw exception from sql when some condition can't match.

I know it can be done from java code, but it may be more straightforward if we use it in sql.

we could throw an runtimeException with the message like MybatisCoditionNotMatchException.

how do you think of it.  please share your opinion. If most approve it, I can make a pull request for it.


Thanks.


--
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:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="LHmqK8i3DwAJ" 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/7a6eea2b-b9f1-4bc4-ab98-c8ac0abd7e16%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/mybatis-user/7a6eea2b-b9f1-4bc4-ab98-c8ac0abd7e16%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/mybatis-user/7a6eea2b-b9f1-4bc4-ab98-c8ac0abd7e16%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/mybatis-user/7a6eea2b-b9f1-4bc4-ab98-c8ac0abd7e16%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/2236dff3-f318-4827-9d58-34549f56caba%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Feature request of add exception tag in xml

Ray Sprinkle
My bigger point is that the argument object should be responsible validating the legal parameters and throwing the exception.  That will also result in the exception being thrown when the problem occurs.

On Sun, Oct 20, 2019, 8:59 PM 葛俊 <[hidden email]> wrote:
Thanks rds.

Using default method can solve the problem for if test statement.

For choose when statement, using exception tag may help for less code in java like following.

Snipaste_2019-10-21_08-55-33.png




















Thanks.






On Friday, October 18, 2019 at 6:28:41 PM UTC+8, rds wrote:
I think that argument validation belongs in the Java code.  Using default methods you could even add the test to the mapper interface.

On Thu, Oct 17, 2019, 11:25 PM 葛俊 <[hidden email]> wrote:
Hi Mybatis Contributors.

I'm thinking of add exception tag to mybatis xml fragment like following.

Snipaste_2019-10-18_11-15-45.png






















When sometime we want to throw exception from sql when some condition can't match.

I know it can be done from java code, but it may be more straightforward if we use it in sql.

we could throw an runtimeException with the message like MybatisCoditionNotMatchException.

how do you think of it.  please share your opinion. If most approve it, I can make a pull request for it.


Thanks.


--
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/7a6eea2b-b9f1-4bc4-ab98-c8ac0abd7e16%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/2236dff3-f318-4827-9d58-34549f56caba%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/CALhVUhwtmZRFHj6griLf-v5s11uFv%3D2ZAVNntam57CXdZKCeQg%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Feature request of add exception tag in xml

葛俊
Thanks for clarifying.

Understand. Agree for your opinion.

Thanks.

On Mon, Oct 21, 2019 at 9:47 AM Ray Sprinkle <[hidden email]> wrote:
My bigger point is that the argument object should be responsible validating the legal parameters and throwing the exception.  That will also result in the exception being thrown when the problem occurs.

On Sun, Oct 20, 2019, 8:59 PM 葛俊 <[hidden email]> wrote:
Thanks rds.

Using default method can solve the problem for if test statement.

For choose when statement, using exception tag may help for less code in java like following.

Snipaste_2019-10-21_08-55-33.png




















Thanks.






On Friday, October 18, 2019 at 6:28:41 PM UTC+8, rds wrote:
I think that argument validation belongs in the Java code.  Using default methods you could even add the test to the mapper interface.

On Thu, Oct 17, 2019, 11:25 PM 葛俊 <[hidden email]> wrote:
Hi Mybatis Contributors.

I'm thinking of add exception tag to mybatis xml fragment like following.

Snipaste_2019-10-18_11-15-45.png






















When sometime we want to throw exception from sql when some condition can't match.

I know it can be done from java code, but it may be more straightforward if we use it in sql.

we could throw an runtimeException with the message like MybatisCoditionNotMatchException.

how do you think of it.  please share your opinion. If most approve it, I can make a pull request for it.


Thanks.


--
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/7a6eea2b-b9f1-4bc4-ab98-c8ac0abd7e16%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/2236dff3-f318-4827-9d58-34549f56caba%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/CALhVUhwtmZRFHj6griLf-v5s11uFv%3D2ZAVNntam57CXdZKCeQg%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/CAL2GnOG5MQ7ALdgTf2YDt44Bkoi0iJzZdGPQL8sc0mA8CTdJgg%40mail.gmail.com.