Hi Prasath, Thank you very much for sharing your very interesting use-case with us. I'm aware of other users who integrated jOOQ with Hibernate in a similar way. Let's hope they too will share their experience.
Some comments from my side, inline: 2016-04-11 9:29 GMT+02:00 <[email protected]>: > Hi, > > I am using jooq with hibernate in my project for data persistence. > > jooq - for read operations. > hibernate - for saving, deleting, updating data. > > Jooq and hibernate have their own independent datasources configured > pointing to same underlying database. > > 1. Is it possible to make the jooq datasource read only- to restrict > save, update and delete using jooq? > Depending on your database / JDBC driver, there are some measures you can take to prevent write operations on that level. For instance, if you're using Oracle, you should certainly create a separate database user and only grant SELECT privilege to that user. In addition to the above, within jOOQ, you can implement an ExecuteListener, and intercept already the ExecuteListener.start() event. >From the argument ExecuteContext.type(), you can see whether the jOOQ object being executed is any of: - A routine - A batch statement - A DDL operation - A Read operation - A Write operation - Something else In your case, you'd only allow read operations. Otherwise, you could throw an exception. All statement types executed by jOOQ are guaranteed to run by the ExecuteListener lifecycle. More info here: http://www.jooq.org/doc/latest/manual/sql-execution/execute-listeners > 2. What is the difference in the transaction management feature supported > by hibernate and jooq? Is there any transaction management feature > supported by hibernate which is not available in jooq? > Yes, many. jOOQ does provide a transaction API, but not really an implementation. The idea of the jOOQ transaction API is to make using transactions more explicit, by providing a functional API where you can pass "transactional lambdas" to jOOQ. The transaction semantics is most often implemented by JDBC, JTA, Spring, etc. Users are expected to bring their own jOOQ TransactionProviders. In that way, jOOQ can work inside of Hibernate's transactions, or inside of JDBC's transactions, or inside of your JTA UserTransactions, etc. 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
