Hi Durim, Thanks for your message and for your nice words.
Let me comment inline 2017-04-02 19:13 GMT+01:00 Durim Kryeziu <durimkryez...@gmail.com>: > Hello, > > I'm very new to jOOQ library and I really like this library based on what > I saw in the official web site. > > I'm working on a Spring Boot application which I package as a *war* file > to deploy to an external Tomcat Server. > First I want to use jOOQ only as a SQL query builder, and I have to > connect to a database with many tables and don't want to generate sources > every time because it takes a while to finish. > > Is it possible, if so, then can you give me some hints or guide me how to > do that ? > Thanks in advance > We generally recommend to use Flyway for database migrations and then listen to Flyway-generated schema changes prior to regenerating jOOQ code. I've recently written a blog post about this: https://blog.jooq.org/2014/06/25/flyway-and-jooq-for-unbeatable-sql-development-productivity/ Of course, it would work with any other database migration tool, just Flyway makes this very easy. Another decision you should make is whether you want to re-generate the jOOQ classes at every build, or check them in to your version control system. I personally favour the latter (although I perfectly understand arguments in favour of the former), and then build a jooq-db.jar file, which you can then package in your war file. This should be rather easy to do with Maven. > > I want to use the Programmatic configuration to be able to access some > environment variables for database credentials through > *Environment* > So, I created a @RestController and @Autowired the Environment bean and > exposed through a URL to be able to Generate the sources only when I want > to: > > @RestController > @RequestMapping("jooq/generate-sources") > public class CodeGeneratorController { > > private Environment env; > > @Autowired > public CodeGeneratorController(Environment env) { > this.env = env; > } > > @RequestMapping(method = RequestMethod.POST) > public ResponseEntity generateSources() throws Exception { > > Configuration configuration = new Configuration() > .withLogging(Logging.INFO) > .withJdbc(new Jdbc() > .withDriver("com.mysql.jdbc.Driver") > .withUsername(env.getRequiredProperty("DB_USERNAME")) > .withPassword(env.getRequiredProperty("DB_PASSWORD")) > .withUrl(env.getRequiredProperty("DB_URL"))) > .withGenerator(new Generator() > .withDatabase(new Database() > .withName("org.jooq.util.mysql.MySQLDatabase") > .withIncludes(".*") > .withInputSchema("my_schema")) > .withTarget(new Target() > .withEncoding("UTF-8") > > .withPackageName("com.my.package.data.generated-sources") > .withDirectory("src/main/java"))); > > GenerationTool.generate(configuration); > > return ResponseEntity.ok().build(); > } > } > > > Also jOOQ related I have these dependencies on my pom.xml file: > > <dependency> > <groupId>org.springframework.boot</groupId> > <artifactId>spring-boot-starter-jooq</artifactId> > </dependency> > > <dependency> > <groupId>org.jooq</groupId> > <artifactId>jooq-codegen</artifactId> > </dependency> > > > > Then when I try to start the application (with IntelliJ IDEA, already > configured to run on Tomcat) I see this message: > 2017-04-02 19:53:10.591 WARN 92073 --- [on(2)-127.0.0.1] > ationConfigEmbeddedWebApplicationContext : Exception encountered during > context initialization - cancelling refresh attempt: org.springframework. > beans.factory.BeanCreationException: Error creating bean with name > 'dslContext' defined in class path resource [org/springframework/boot/auto > configure/jooq/JooqAutoConfiguration$DslContextConfiguration.class]: > Post-processing > of merged bean definition failed; nested exception is java.lang. > StackOverflowError > > And then this exception: > Hmm, that looks like a Spring Boot related exception. I'd report that to: https://github.com/spring-projects/spring-boot >From a high level, I'm not sure if there's a bug in that JooqAutoConfiguration class, or if you've made a mistake configuring it, though... Hope this helps, Lukas -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.