Lucas, 

thanks a lot. We are trying to use JOOQ as an abstract querying layer

- description of the business objects is done through interfaces, not SQL 
tables
- we only like to leverage the Query DSL together with the generated Table 
classes to provide a type safe query language
- the implementation of the query builder will be simplistic and done by 
ourselves and only provide selection and ordering

We have different java systems and we want to pass queries between these 
systems without any knowledge about the persistency mechanism. We are using 
only part of JOOQ; the idea is that JOOQ provides us with a stable and 
mature query dsql and the implementation of the query is up to the provider 
of the system.

Therefore, we need to create Table objects that mirror our DTO used to 
exchange business objects across systems.

Hope this clarifies things
Frank


On Tuesday, April 21, 2015 at 2:21:49 PM UTC+2, Lukas Eder wrote:
>
> Hello,
>
> I'm not 100% sure if I understood what you're really after. Maybe, a bit 
> of code to show your intent by example might help...?
>
> In any case, I can already answer some of your questions:
>
> 2015-04-21 12:57 GMT+02:00 <[email protected] <javascript:>>:
>
>> Hi, 
>>
>> i am new to JOOQ. May I ask if this possible
>>
>> 1. specify a list of interfaces that represent DTO, for instance IMyBook
>>
>
> You can use generator strategies to add interfaces to generated DTOs 
> (POJOs):
>
> - 
> http://www.jooq.org/doc/latest/manual/code-generation/codegen-generatorstrategy/
> - 
> http://www.jooq.org/doc/latest/manual/code-generation/codegen-matcherstrategy/
>
> Essentially, you're looking for the "class implements" property:
>
>     /**
>      * Override this method to define the interfaces to be implemented by 
> those
>      * artefacts that allow for custom interface implementation
>      */
>     @Override
>     public List<String> getJavaClassImplements(Definition definition, Mode 
> mode) {
>         return Arrays.asList(Serializable.class.getName(), 
> Cloneable.class.getName());
>     }
>
>  
> Or:
>
>           <!-- These elements influence the naming of a generated POJO 
> object.  -->
>           <pojoClass> --> MatcherRule </pojoClass>
>           <pojoExtends>com.example.MyOptionalCustomBaseClass</pojoExtends>
>           
> <pojoImplements>com.example.MyOptionalCustomInterface</pojoImplements>
>
>
> 2. have the generator generate MYBOOK 
>> 3. so that i am able to use it in queries 
>> query.create().from(MYBOOK).where(MYBOOK.bookId.equals(...));
>>
>
> That already works - MYBOOK is of type org.jooq.Table. In order to map the 
> query result records into your DTO, you can use the into() methods. Details 
> can be found in the RecordMapper documentation:
>
> http://www.jooq.org/doc/latest/manual/sql-execution/fetching/recordmapper/
>
> Does this respond to your questions? Or did you have anything else in mind?
>
> 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/d/optout.

Reply via email to