Thanks Lukas and thanks again for a great library.
Hey guys, please let me know if you're using jOOQ already in Play how
you're using it and what you might be looking for with the Plugin.
Right now it's very simply and does the code generation on start up if it's
in Dev or Test mode. One issue is that because it regenerates on every app
startup it may generate when there was no change in the Schema which means
that it will regenerate the 'serialVersionUID' in some files causing them
to be marked as changed in your scm.
I nice way of tracking whether it needs to do the generation would fix
this. One possible but largish solution would be to replace the evolutions
plugin with one in the jOOQ plugin.
Also it's just leaving the connection management up to you so if you want
to run a query you just use the DSL.using method and give it a Connection
that you can get from Play with DB.getConnection()
I've been thinking of ways to make this nicer and was thinking of adding in
a JooqDB class to the plugin to allow you instead to just write:
JooqDB.dsl().select() and JooqDB would wrap up the building of the
Configuration to pass to DSL.using().
By default it could just use a ConnectionProvider that automatically closes
off the connection for you. But this is really simple case stuff and people
will want transaction support.
So I'd like to hear also how people are handling transactions and if
transaction support would be something people would like in the Plugin.
There a few ways this could go.
The simplest would be to just use a transactional aware ConnectionProvider
that just does the commit / rollback in the release() method.
I could add a transaction wrapper on JooqDB so you could call it like this:
Task task = JooqDB.transaction(new WrappedTransaction<Task>() {
@Override
public Task apply(DSLContext dsl) throws Throwable {
return dsl.insertInto(Tables.TASK, Tables.TASK.LABEL)
.values(label)
.returning()
.fetchOne()
.into(Task.class);
}
});
This will only wrap those statements that are executed inside apply.
Another possibility is to make it similar to the JPA plugin and allow the
methods on controllers to be wrapped in a transaction using actions. eg:
@JooqTransactional
public Result createTask() {
JooqDB.dsl().selectFrom(Tables.TASK).fetch().into(Task.class);
JooqDB.dsl().insertInto(Tables.TASK, Tables.TASK.LABEL)
.values(label)
.returning()
.fetchOne()
.into(Task.class);
return redirect(routes.Application.index());
}
Which means that statements would be committed at the end.
Anyway love to hear peoples thoughts.
Cheers,
Jaie
On Sunday, July 28, 2013 5:56:33 PM UTC+10, Lukas Eder wrote:
>
> Dear group,
>
> I would like to advertise a third-party piece of work by Jaie Wilson, who
> has been creating a Play Framework integration for jOOQ:
> https://github.com/jaiew/play-jooq
>
> This integration was discussed here in this issue:
> https://github.com/jOOQ/jOOQ/issues/768
>
> Feel free to join the discussion and provide feedback if you're using /
> planning to use jOOQ with Play Framework
>
> Best Regards,
> 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.