Eclipse: MyBatis generator plugin settings (SQL Scripts)

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

Eclipse: MyBatis generator plugin settings (SQL Scripts)

yuri.redaelli
Hi all,

using the Eclipse MyBatis generator plugin I've noticed that there's a tab where I can specify the JDBC connection details.

Is it possible to create a generator-config.xml in order to take this settings dynamically and not hard-coding them into the XML?

I need to have a single generator-config.xml for several developers with different JDBC connection parameters.

When I run it I have an error because jdbcConnetion or ConnectionFactory xml node are mandatory.

Thanks in adavance.

--
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: Eclipse: MyBatis generator plugin settings (SQL Scripts)

Jeff Butler
You can use property markers in the configuration file - like ${juserId}. Then you can use the regular Java methods to pass property values in.

Jeff Butler


On Fri, Sep 28, 2018 at 3:15 AM <[hidden email]> wrote:
Hi all,

using the Eclipse MyBatis generator plugin I've noticed that there's a tab where I can specify the JDBC connection details.

Is it possible to create a generator-config.xml in order to take this settings dynamically and not hard-coding them into the XML?

I need to have a single generator-config.xml for several developers with different JDBC connection parameters.

When I run it I have an error because jdbcConnetion or ConnectionFactory xml node are mandatory.

Thanks in adavance.

--
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.

--
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: Eclipse: MyBatis generator plugin settings (SQL Scripts)

yuri.redaelli
Hi Jeff thanks for your answer but unfortunately I didn't understand.

Can you show me a simple code example?

Thanks again.

Il giorno sabato 29 settembre 2018 14:39:55 UTC+2, Jeff Butler ha scritto:
You can use property markers in the configuration file - like ${juserId}. Then you can use the regular Java methods to pass property values in.

Jeff Butler


On Fri, Sep 28, 2018 at 3:15 AM <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="U9UX5fChAAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">yuri.r...@...> wrote:
Hi all,

using the Eclipse MyBatis generator plugin I've noticed that there's a tab where I can specify the JDBC connection details.

Is it possible to create a generator-config.xml in order to take this settings dynamically and not hard-coding them into the XML?

I need to have a single generator-config.xml for several developers with different JDBC connection parameters.

When I run it I have an error because jdbcConnetion or ConnectionFactory xml node are mandatory.

Thanks in adavance.

--
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="U9UX5fChAAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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: Eclipse: MyBatis generator plugin settings (SQL Scripts)

Jeff Butler
One thing to be clear about - the driver parameters on the SQL Script tab are only for running a script before running the generator.

You can write XML like this...

<generatorConfiguration>

  <context id="context1">

    <jdbcConnection connectionURL="${dbURL}" driverClass="${driverClass}" password="${pwd}" userId="${userId}" />

    ...

  </context>

</generatorConfiguration>


Once you have that then you can pass the property values with Java like "java -DdriverClass=org.foo.Bar" etc. You can also pass property values via Ant or Maven. How are you planning to run these different varieties of the generator?


Jeff Butler



On Mon, Oct 1, 2018 at 2:12 AM <[hidden email]> wrote:
Hi Jeff thanks for your answer but unfortunately I didn't understand.

Can you show me a simple code example?

Thanks again.

Il giorno sabato 29 settembre 2018 14:39:55 UTC+2, Jeff Butler ha scritto:
You can use property markers in the configuration file - like ${juserId}. Then you can use the regular Java methods to pass property values in.

Jeff Butler


On Fri, Sep 28, 2018 at 3:15 AM <[hidden email]> wrote:
Hi all,

using the Eclipse MyBatis generator plugin I've noticed that there's a tab where I can specify the JDBC connection details.

Is it possible to create a generator-config.xml in order to take this settings dynamically and not hard-coding them into the XML?

I need to have a single generator-config.xml for several developers with different JDBC connection parameters.

When I run it I have an error because jdbcConnetion or ConnectionFactory xml node are mandatory.

Thanks in adavance.

--
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.

--
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.

--
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: Eclipse: MyBatis generator plugin settings (SQL Scripts)

yuri.redaelli
Hi,

the reason why I need different varieties of the generator is that there are several developers on the same project and each one has its own JDBC configuration settings.

I don't want this kind of mess so I'm trying to find a solution in order to have a single configuration file for everyone.

I want to specify that I need to execute the MBG using the Eclipse plugin for the benefit of the Java file merging.

In this case is it possibile (and how) to pass parameters like you suggested before?

Thanks again.


Il giorno lunedì 1 ottobre 2018 19:48:15 UTC+2, Jeff Butler ha scritto:
One thing to be clear about - the driver parameters on the SQL Script tab are only for running a script before running the generator.

You can write XML like this...

<generatorConfiguration>

  <context id="context1">

    <jdbcConnection connectionURL="${dbURL}" driverClass="${driverClass}" password="${pwd}" userId="${userId}" />

    ...

  </context>

</generatorConfiguration>


Once you have that then you can pass the property values with Java like "java -DdriverClass=org.foo.Bar" etc. You can also pass property values via Ant or Maven. How are you planning to run these different varieties of the generator?


Jeff Butler



On Mon, Oct 1, 2018 at 2:12 AM <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="X5I9iO1PAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">yuri.r...@...> wrote:
Hi Jeff thanks for your answer but unfortunately I didn't understand.

Can you show me a simple code example?

Thanks again.

Il giorno sabato 29 settembre 2018 14:39:55 UTC+2, Jeff Butler ha scritto:
You can use property markers in the configuration file - like ${juserId}. Then you can use the regular Java methods to pass property values in.

Jeff Butler


On Fri, Sep 28, 2018 at 3:15 AM <[hidden email]> wrote:
Hi all,

using the Eclipse MyBatis generator plugin I've noticed that there's a tab where I can specify the JDBC connection details.

Is it possible to create a generator-config.xml in order to take this settings dynamically and not hard-coding them into the XML?

I need to have a single generator-config.xml for several developers with different JDBC connection parameters.

When I run it I have an error because jdbcConnetion or ConnectionFactory xml node are mandatory.

Thanks in adavance.

--
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 mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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="X5I9iO1PAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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: Eclipse: MyBatis generator plugin settings (SQL Scripts)

Jeff Butler
Makes sense to me.

Unfortunately, I did not think to provide a capability to set environment variables in the launch configuration - I will add that for the next release.

Until then, you could write an Ant script to run the generator using the Eclipse based Ant task and you could set property values in that script. There's an example of such a script in the Eclipse help for the generator.

Jeff Butler


On Tue, Oct 2, 2018 at 3:04 AM <[hidden email]> wrote:
Hi,

the reason why I need different varieties of the generator is that there are several developers on the same project and each one has its own JDBC configuration settings.

I don't want this kind of mess so I'm trying to find a solution in order to have a single configuration file for everyone.

I want to specify that I need to execute the MBG using the Eclipse plugin for the benefit of the Java file merging.

In this case is it possibile (and how) to pass parameters like you suggested before?

Thanks again.


Il giorno lunedì 1 ottobre 2018 19:48:15 UTC+2, Jeff Butler ha scritto:
One thing to be clear about - the driver parameters on the SQL Script tab are only for running a script before running the generator.

You can write XML like this...

<generatorConfiguration>

  <context id="context1">

    <jdbcConnection connectionURL="${dbURL}" driverClass="${driverClass}" password="${pwd}" userId="${userId}" />

    ...

  </context>

</generatorConfiguration>


Once you have that then you can pass the property values with Java like "java -DdriverClass=org.foo.Bar" etc. You can also pass property values via Ant or Maven. How are you planning to run these different varieties of the generator?


Jeff Butler



On Mon, Oct 1, 2018 at 2:12 AM <[hidden email]> wrote:
Hi Jeff thanks for your answer but unfortunately I didn't understand.

Can you show me a simple code example?

Thanks again.

Il giorno sabato 29 settembre 2018 14:39:55 UTC+2, Jeff Butler ha scritto:
You can use property markers in the configuration file - like ${juserId}. Then you can use the regular Java methods to pass property values in.

Jeff Butler


On Fri, Sep 28, 2018 at 3:15 AM <[hidden email]> wrote:
Hi all,

using the Eclipse MyBatis generator plugin I've noticed that there's a tab where I can specify the JDBC connection details.

Is it possible to create a generator-config.xml in order to take this settings dynamically and not hard-coding them into the XML?

I need to have a single generator-config.xml for several developers with different JDBC connection parameters.

When I run it I have an error because jdbcConnetion or ConnectionFactory xml node are mandatory.

Thanks in adavance.

--
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.

--
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.

--
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.

--
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: Eclipse: MyBatis generator plugin settings (SQL Scripts)

yuri.redaelli
Thank you very much Jeff.

Bye.

Il giorno martedì 2 ottobre 2018 22:02:46 UTC+2, Jeff Butler ha scritto:
Makes sense to me.

Unfortunately, I did not think to provide a capability to set environment variables in the launch configuration - I will add that for the next release.

Until then, you could write an Ant script to run the generator using the Eclipse based Ant task and you could set property values in that script. There's an example of such a script in the Eclipse help for the generator.

Jeff Butler


On Tue, Oct 2, 2018 at 3:04 AM <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="pnKVHkoNAAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">yuri.r...@...> wrote:
Hi,

the reason why I need different varieties of the generator is that there are several developers on the same project and each one has its own JDBC configuration settings.

I don't want this kind of mess so I'm trying to find a solution in order to have a single configuration file for everyone.

I want to specify that I need to execute the MBG using the Eclipse plugin for the benefit of the Java file merging.

In this case is it possibile (and how) to pass parameters like you suggested before?

Thanks again.


Il giorno lunedì 1 ottobre 2018 19:48:15 UTC+2, Jeff Butler ha scritto:
One thing to be clear about - the driver parameters on the SQL Script tab are only for running a script before running the generator.

You can write XML like this...

<generatorConfiguration>

  <context id="context1">

    <jdbcConnection connectionURL="${dbURL}" driverClass="${driverClass}" password="${pwd}" userId="${userId}" />

    ...

  </context>

</generatorConfiguration>


Once you have that then you can pass the property values with Java like "java -DdriverClass=org.foo.Bar" etc. You can also pass property values via Ant or Maven. How are you planning to run these different varieties of the generator?


Jeff Butler



On Mon, Oct 1, 2018 at 2:12 AM <[hidden email]> wrote:
Hi Jeff thanks for your answer but unfortunately I didn't understand.

Can you show me a simple code example?

Thanks again.

Il giorno sabato 29 settembre 2018 14:39:55 UTC+2, Jeff Butler ha scritto:
You can use property markers in the configuration file - like ${juserId}. Then you can use the regular Java methods to pass property values in.

Jeff Butler


On Fri, Sep 28, 2018 at 3:15 AM <[hidden email]> wrote:
Hi all,

using the Eclipse MyBatis generator plugin I've noticed that there's a tab where I can specify the JDBC connection details.

Is it possible to create a generator-config.xml in order to take this settings dynamically and not hard-coding them into the XML?

I need to have a single generator-config.xml for several developers with different JDBC connection parameters.

When I run it I have an error because jdbcConnetion or ConnectionFactory xml node are mandatory.

Thanks in adavance.

--
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 mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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 mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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="pnKVHkoNAAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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.