Hello Sergey, I'll CC this to the user group as well, as this is probably of general interest
> Your code is great, very good impression. Thank you > I am trying integrate JooQ with Spring. > Let me explain a bit problems that I faced (very briefly, night). > > 1. JooQ Factory is not thread safe (because Connection is not thread safe) > - created project jOOQ-spring that contains thread safe Factory proxy. This would be a valuable extension, that might be useful to other users as well. I checked upon the proxy. I'm not too familiar with Spring for managing data sources. I imagine, that transactions are somehow maintained outside of this proxy? What would some sample service code look like? I'll add Spring integration as a feature request: https://sourceforge.net/apps/trac/jooq/ticket/897 > - added interface FactoryOperations in jOOQ project, that declares > non-static public operations in Factory class > - added setters to SchemaMapping class (to simplify injecting configuration > parameters in spring configuration) That makes sense. > 2. some JooQ Factory methods return SQLException (this is checked exception) > - SQLException removed from method signature, operations return runtime > DataAccessException instead of checked SQLException > This exception is the same as DataAccessException in Spring > http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/dao/DataAccessException.html > 3. no abstraction in SQLException handling (different databases have > different errorCodes) > - added SQLExceptionTranslator > The idea is to map vendor-specific error codes to DataAccessException > descendants > http://www.koders.com/xml/fidE70F96602F7F254B935C711E60F1D141C60CD1DB.aspx > Implementation is very simple (just stub) at this moment. (todo) That's a nice concept. I wasn't aware of this. This will be feature request #898: https://sourceforge.net/apps/trac/jooq/ticket/898 > 4. jars can not be deployed into OSGI environment (jar's are not bundles) > - added configuration of maven-bundle-plugin to pom.xml Is that what org.apache.felix does? Thanks for adding this. It will be included with https://sourceforge.net/apps/trac/jooq/ticket/899 > Preliminary version of these changes in attachment. I am not sure that all > these changes are correct. > Suppose that these changes are important. Release 2.0 is the right time for such changes. Thanks a lot for your help! Cheers Lukas 2011/11/1 Sergey Epik <[email protected]>: > Hi Lukas, > > Your code is great, very good impression. > I am trying integrate JooQ with Spring. > Let me explain a bit problems that I faced (very briefly, night). > > 1. JooQ Factory is not thread safe (because Connection is not thread safe) > - created project jOOQ-spring that contains thread safe Factory proxy. > - added interface FactoryOperations in jOOQ project, that declares > non-static public operations in Factory class > - added setters to SchemaMapping class (to simplify injecting configuration > parameters in spring configuration) > Here is example of spring configuration: > > > <bean id="jooQFactoryProxy" class="org.jooq.spring.JooQFactoryProxy"> > <property name="dataSource" ref="dataSource"/> > <property name="schemaMapping"> > <bean class="org.jooq.SchemaMapping"> > <property name="defaultSchema" value="PROJ_${app.schema}"/> > <property name="schemaMapping"> > <map> > <entry key="PROJ_AA" value="PROJ_AA_${app.schema}"/> > </map> > </property> > </bean> > </property> > <property name="dialect"> > <value type="org.jooq.SQLDialect">ORACLE</value> > </property> > </bean> > > inject it into the service: > > <bean id="fooService" class="com.example.FooServiceImpl"> > <property name="jooQ" ref="jooQFactoryProxy"/> > </bean> > > 2. some JooQ Factory methods return SQLException (this is checked exception) > - SQLException removed from method signature, operations return runtime > DataAccessException instead of checked SQLException > This exception is the same as DataAccessException in Spring > http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/dao/DataAccessException.html > 3. no abstraction in SQLException handling (different databases have > different errorCodes) > - added SQLExceptionTranslator > The idea is to map vendor-specific error codes to DataAccessException > descendants > http://www.koders.com/xml/fidE70F96602F7F254B935C711E60F1D141C60CD1DB.aspx > Implementation is very simple (just stub) at this moment. (todo) > 4. jars can not be deployed into OSGI environment (jar's are not bundles) > - added configuration of maven-bundle-plugin to pom.xml > > Preliminary version of these changes in attachment. I am not sure that all > these changes are correct. > Suppose that these changes are important. > > Best regards, > Sergey >
