Hi Mostafa,
As I said, I believe you're using an "old" Spring configuration format with
a "new" jOOQ version. As mentioned before, we have a "regression" because
we changed internal API, which we - unfortunately - documented in the
manual's Spring examples (we'll fix that).
To be more specific, your DefaultConfiguration setup is no longer valid.
Yours:
<bean class="org.jooq.impl.DefaultConfiguration" name="config">
<constructor-arg index="0" ref="connectionProvider" />
<constructor-arg index="1"><null /></constructor-arg>
<constructor-arg index="2"><null /></constructor-arg>
<constructor-arg index="3">
<list>
<bean class="org.jooq.impl.DefaultExecuteListenerProvider">
<constructor-arg index="0"
ref="exceptionTranslatorJooq"/>
</bean>
</list>
</constructor-arg>
<constructor-arg index="4"><null /></constructor-arg>
<constructor-arg name="dialect"><value type="org.jooq.SQLDialect">ORA
CLE</value></constructor-arg>
</bean>
The manual's (
http://www.jooq.org/doc/latest/manual/getting-started/tutorials/jooq-with-spring
)
<bean class="org.jooq.impl.DefaultConfiguration" name="config">
<constructor-arg index="0" ref="connectionProvider" />
<constructor-arg index="1"><null /></constructor-arg>
<constructor-arg index="2"><null /></constructor-arg>
<constructor-arg index="3">
<list>
<bean class="org.jooq.impl.DefaultExecuteListenerProvider">
<constructor-arg index="0" ref="exceptionTranslator"/>
</bean>
</list>
</constructor-arg>
<constructor-arg index="4"><null /></constructor-arg>
<constructor-arg index="5"><value
type="org.jooq.SQLDialect">H2</value></constructor-arg>
<constructor-arg index="6"><null /></constructor-arg>
<constructor-arg index="7"><null /></constructor-arg>
</bean>
The constructor call now has more arguments.
Hope this helps,
Lukas
2014-06-09 6:49 GMT+02:00 Mostafa Shafeian <[email protected]>:
> hi
> My spring config is:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
>
>
> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close" >
> <property name="url" value="jdbc:oracle:thin:@//
> 192.168.50.161:1522/orcl" />
> <property name="driverClassName" value="oracle.jdbc.OracleDriver" />
> <property name="username" value="a`123" />
> <property name="password" value="123456" />
> </bean>
>
> <!-- Configure the DSL object, optionally overriding jOOQ Exceptions
> with Spring Exceptions -->
> <bean id="dsl" class="org.jooq.impl.DefaultDSLContext" name="dslBook">
> <constructor-arg ref="config" />
> </bean>
>
> <bean id="transactionAwareDataSource"
>
> class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
> <constructor-arg ref="dataSource" />
> </bean>
>
> <bean class="org.jooq.impl.DataSourceConnectionProvider"
> name="connectionProvider">
> <constructor-arg ref="transactionAwareDataSource" />
> </bean>
>
> <bean id="exceptionTranslatorJooq"
> class="org.jooq.example.spring.exception.ExceptionTranslator" />
>
>
> <bean class="org.jooq.impl.DefaultConfiguration" name="config">
> <constructor-arg index="0" ref="connectionProvider" />
> <constructor-arg index="1"><null /></constructor-arg>
> <constructor-arg index="2"><null /></constructor-arg>
> <constructor-arg index="3">
> <list>
> <bean class="org.jooq.impl.DefaultExecuteListenerProvider">
> <constructor-arg index="0"
> ref="exceptionTranslatorJooq"/>
> </bean>
> </list>
> </constructor-arg>
> <constructor-arg index="4"><null /></constructor-arg>
> <constructor-arg name="dialect"><value
> type="org.jooq.SQLDialect">ORACLE</value></constructor-arg>
> </bean>
> <!-- This is the "business-logic" -->
> <bean id="reprot" class="com.saminray.report.DefaultBookService" >
> <constructor-arg name="pDSL" ref="config"/>
> </bean>
> </beans>
>
> I implement Report class as :
>
> Report(DefaultConfiguration pDSL)
> {
> dsl_internal=DSL.using(pDSL);
> }
>
> public void PkgTopic_getsumtopicrecords(int dateFrom ,int
> integerDateTo ,int StartWithID , int LevelFrom ,int LevelTo ,int
> NotShowZero ) {
>
> Configuration configuration = dsl_internal.configuration();
>
> org.jooq.Result<org.jooq.Record> res = null;
> res = PkgTopic.getsumtopicrecords(configuration, dateFrom,
> integerDateTo, StartWithID, LevelFrom, LevelTo, NotShowZero);
> List<Topic> list= res.into(Topic.class);
> System.out.println("Size="+list.size());
> }
>
> Cann you help me or explain more?
> thanks alot
>
>
>
> On Sunday, June 8, 2014 6:40:31 AM UTC-7, Lukas Eder wrote:
>
>> I'm pretty sure you've been looking at the wrong manual version for the
>> jOOQ version you're using.
>>
>> Unfortunately, we're exposing internal API through that particular
>> section of the manual, suggesting users to create DefaultConfigurations
>> using package-private constructors through Spring. We'll fix that issue in
>> future versions of jOOQ, where we'll provide example documentation that
>> doesn't use internal API.
>> https://github.com/jOOQ/jOOQ/issues/3328
>>
>> Sorry for the inconvenience.
>>
>> Cheers
>> Lukas
>>
>>
>> 2014-06-08 12:16 GMT+02:00 Mostafa Shafeian <[email protected]>:
>>
>>> Hi everybody
>>> I used jood with spring in eclipse.In configuration file I wrote:
>>> <bean class="org.jooq.impl.DefaultConfiguration" name="config">
>>> <constructor-arg index="0" ref="connectionProvider" />
>>> <constructor-arg index="1"><null /></constructor-arg>
>>> <constructor-arg index="2"><null /></constructor-arg>
>>> <constructor-arg index="3">
>>> <list>
>>> <bean class="org.jooq.impl.
>>> DefaultExecuteListenerProvider">
>>> <constructor-arg index="0"
>>> ref="exceptionTranslatorJooq"/>
>>> </bean>
>>> </list>
>>> </constructor-arg>
>>> <constructor-arg index="4"><null /></constructor-arg>
>>> <constructor-arg name="dialect"><value type="org.jooq.SQLDialect">
>>> ORACLE</value></constructor-arg>
>>> </bean>
>>> But I get an error:
>>> Error creating bean with name 'config' defined in class path resource
>>> [spring1.xml]: Could not resolve matching constructor (hint: specify
>>> index/type/name arguments for simple parameters to avoid type ambiguit
>>> ies)
>>> How can solve this problem?
>>> thnks
>>>
>>> --
>>> 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.
>>>
>>
>> --
> 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.
>
--
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.