I don't know if this helps or if it's a best practice, but I extended the 
JavaGenerator to inject the Configuration. Sadly setConfiguration in 
DaoImpl is final so I had to create a new method for all DAOs. Here is the 
Generator-Class:

public class InjectConfigurationGenerator extends JavaGenerator {

    @Override
    protected void generateDaoClassFooter(TableDefinition table, JavaWriter 
out) {
        super.generateDaoClassFooter(table, out);
        out.tab(1).println("@com.google.inject.Inject");
        out.tab(1).println("public void injectConfiguration(Configuration 
configuration) {");
            out.tab(2).println("super.setConfiguration(configuration);");
        out.tab(1).println("}");
    }

    @Override
    protected void printClassAnnotations(JavaWriter out, SchemaDefinition 
schema) {
        super.printClassAnnotations(out, schema);
        if(out.file().getName().contains("Dao")){
            out.println("@%s", "com.google.inject.Singleton");
        }
    }

}

Has anyone a better idea how to implement this properly?

Am Mittwoch, 14. Oktober 2015 17:22:52 UTC+2 schrieb Lukas Eder:
>
> Hi Sachin,
>
> Well, yes you can do that. The generated DAO just links the generated 
> Table to the generated POJO type, and adds some convenience methods for 
> fetching.
>
> What is the concern you are having? I mean, why did you think there might 
> be a risk in doing so?
>
> Cheers,
> Lukas
>
> 2015-10-12 18:26 GMT+02:00 <[email protected] <javascript:>>:
>
>> Hi Lukas,
>>
>> My query is, can I directly use the generated DAO in production 
>> environment.
>>
>> Thanks,
>> Sachin
>>
>> --
>> 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] <javascript:>.
>> 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.

Reply via email to