Hello Christian, There are two steps to follow. First, you have to introspect the primaryKey's columns via UniqueKeyDefinition.getKeyColumns() Then, you have to find out the applicable Java type via ColumnDefinition.getType().getJavaType(). There you should have everything you need. Perhaps, some debugging through the code generator might also help to find out what API elements will return the most appropriate information. You could even make use of JavaGenerator's internals in order to generate imports for such types.
I'm not sure how you intend to model composite primary keys. It could be done e.g. with a jOOλ Tuple[N] type (see https://github.com/jOOQ/jOOL) I hope this helps. Let me know if you have any specific questions about the above. Lukas 2016-06-20 13:04 GMT+01:00 Christian Meyer <[email protected]>: > Hi Lukas, > > looks like I need some help from you. > Currently, I have an interface which looks like this: > > public interface IdentifiableDomain<PK extends Serializable> { > PK getPrimaryKey(); > } > > Now I also have a generator class: > > public class DomainGenerator extends JavaGenerator { > > @Override > protected void generatePojoClassFooter(TableDefinition table, > JavaWriter out) { > UniqueKeyDefinition primaryKey = table.getPrimaryKey(); > } > > } > > And now, I don't know how to get any further. How can I get the specific > primary key type from UniqueKeyDefinition? > > Thanks a lot... > > ciao > Christian > > -- > 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.
