What's the function of "order" attribute in SelectKey element?

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

What's the function of "order" attribute in SelectKey element?

rocky
The SelectKey element have a "order" attribute, what's the function of if, i read the source code and i didn't find any clue. The SelectKeyGenerator is the tool class to generate the key, but no matter the order is,it all execute the "processGeneratedKeys" method, what's the "order" is?

--
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].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: What's the function of "order" attribute in SelectKey element?

Kazuki Shimizu
Reference documents say about order attribute as follow:

This can be set to BEFORE or AFTER. If set to BEFORE, then it will select the key first, set the keyProperty and then execute the insert statement. If set to AFTER, it runs the insert statement and then the selectKeystatement – which is common with databases like Oracle that may have embedded sequence calls inside of insert statements.

Could you resolve your question?


On Saturday, November 4, 2017 at 1:30:30 AM UTC+9, rocky_hu wrote:
The SelectKey element have a "order" attribute, what's the function of if, i read the source code and i didn't find any clue. The SelectKeyGenerator is the tool class to generate the key, but no matter the order is,it all execute the "processGeneratedKeys" method, what's the "order" is?

--
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].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: What's the function of "order" attribute in SelectKey element?

rocky
Yes,  It's useful.

On Saturday, November 4, 2017 at 8:58:23 AM UTC+8, Kazuki Shimizu wrote:
Reference documents say about order attribute as follow:

This can be set to BEFORE or AFTER. If set to BEFORE, then it will select the key first, set the keyProperty and then execute the insert statement. If set to AFTER, it runs the insert statement and then the selectKeystatement – which is common with databases like Oracle that may have embedded sequence calls inside of insert statements.

Could you resolve your question?


On Saturday, November 4, 2017 at 1:30:30 AM UTC+9, rocky_hu wrote:
The SelectKey element have a "order" attribute, what's the function of if, i read the source code and i didn't find any clue. The SelectKeyGenerator is the tool class to generate the key, but no matter the order is,it all execute the "processGeneratedKeys" method, what's the "order" is?

--
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].
For more options, visit https://groups.google.com/d/optout.