Target languages and forms
Templating language
Style
Generator strategies
Disambiguation / compiler "optimisations"
Custom code
Templating languageAfter working with both Slick code generation and JOOQ code generation I have been curious why no one has tried to use an HTML templating library. It is code that generates code dynamically and already has tons of useful built in features such as includes / partials / conditionals / loops. I would be interested to try and take a JSON representation of the database and run it through HTML templates and see how natural it feels. I think an added benefit would be the ability to add hooks into the code generation wherever you wanted by just modifying / customizing a few html templates.
Custom codeI have had a pretty good experience customizing the JOOQ DAO generators on my own. I was able to auto generate some additional queries that I would use frequently. Getting the code in the right places was sometimes difficult. I felt somewhat limited by the hooks to add custom code. At the same time I don't think adding additional hooks is the right solution. You could end up with tons of before / after hooks for every section of code and that could get out of hand quickly.
Interesting. I hadn't thought about HTML templating libraries. In the Java ecosystem, velocity used to be a popular templating language. But as most templating languages are external DSLs, they are equally flawed compared to Xtend in that they can't really interact well with Java APIs (e.g. with jOOQ-meta)
I think it will be hard to beat Xtend in this area, although I'm very open to suggestions...
Dear group,The jOOQ code generator is one of the biggest assets when using jOOQ. It allows for referring to your schema in a type safe way, allowing to leverage IDE auto completion with tables, columns, procedures, etc.However, it has grown organically and it thus doesn't allow for the extensibility that some of you would like. It is time to start thinking about the future of jOOQ-codegen and jOOQ-meta, to collect ideas for jOOQ 4.0 in that area, or perhaps even for prior releases. So, this is a good time to chime in and discuss potential requirements.The relevant issue is:These are, roughly, the existing features, or existing feature requests:1. Target languages and formsjOOQ currently supports Java and Scala - the most popular languages on the JVM. Does it make sense to support other languages? Or perhaps even data formats, like XML?This is an interesting topic, but it is also very demanding in terms of complexity budget. Alternative languages cannot be integration tested as well as Java without adding substantial effort.
2. Templating languageThe code generator currently uses a home-grown templating "language" via a home-grown, internal, undocumented API.In the past, users have suggested using Xtend (http://www.eclipse.org/xtend) instead. The advantage of Xtend is that the template language is built into the Xtend language, and it feels extremely natural.At the time, the idea of integrating Xtend was rejected, because the Xtend tooling was very Eclipse dependent. This is no longer true, and Xtend is still a very interesting consideration.Alternatively, a programmatic language model (like XJC has) could be interesting, although it would be very limiting in terms of what's possible in 1. Target languages.
3. StyleProgrammers like endless discussions about curly braces, indentations, tabs and spaces. jOOQ currently doesn't embrace this sort of "creativity" :-)It would be great if the generated code style could be influenced in one way or another, although, this is a rather low priority.
4. Generator strategiesMost customization is about naming style. Do you want your database objects in PascalCase? camelCase? UPPER_CASE? lower_case?
Is this feature sufficient? What's missing here?
//Query Codefinal ClientListing listing = dslContext.select( CLIENT.ID, CLIENT.NAME, CLIENT.PARENT_ID ) .from(CLIENT) .where(CLIENT.ID.eq(id)) .fetchOneInto(ClientListing.class);//Bean Construction code below.@ConstructorProperties({ "id", "name", "parentId" }) public ClientListing(final long id, final String name, final Long parentId) { this.id = id; this.name = name; this.parentId = parentId; }
5. Disambiguation / compiler "optimisations"jOOQ code compiles almost always. We've thought of many edge-cases where generated code might cause conflict, e.g. because of naming ambiguity, invalid identifiers, etc. This is a must-have in any future implementation.
// Define Jooq Tables from the UI Schema
private static class UI {
protected static final
com.foobar.package.ui.tables.Client CLIENT =
com.foobar.package.ui.Tables.CLIENT;
}
private static class DATA {
protected static final
com.foobar.package.data.tables.Client CLIENT =
com.foobar.package.data.Tables.CLIENT;
}
6. Custom codeCurrently, there are a few ad-hoc means of introducing custom code into generated artefacts. This is mostly done via method extension, which is rather limiting.Recently, there has been quite a bit of criticism about the generated DAOs, and the fact that they're not really useful for use with Spring or CDI. That's true, but we don't want to patch them little by little, adding not well thought through features at this point.Instead, YOU should be able to generate DAOs (or repositories, or services, or session beans) very easily yourself, using jOOQ-meta and a better jOOQ-codegen. YOU should then be able to publish your jOOQ code generation "plugins" for reuse in the community.Other use-cases are:5.1. Support for additional validation annotations5.2. Support for additional Spring or Java EE annotations5.3. Support for JPA annotations5.4. Support for fluent setters5.5. Support for alternative object types (e.g. repositories, services, etc.)5.6. Mutable / immutable POJOs.5.7. "Views" expressed in jOOQ (i.e. SQL strings that should generate as org.jooq.Table)In fact, I believe that the core code generation functionality should be built upon such a plugin system, rather than providing tons of flags to turn on/off individual featuresBe a part of itI'm looking forward very much to your feedback, and enthusiast discussion!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 jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Interesting. I hadn't thought about HTML templating libraries. In the Java ecosystem, velocity used to be a popular templating language. But as most templating languages are external DSLs, they are equally flawed compared to Xtend in that they can't really interact well with Java APIs (e.g. with jOOQ-meta)I would probably pick something bare bones like mustache for the HTML templating language. I think there are a few pros and cons. It could make code gen language agnostic, most people already know HTML / HTML templating, code customization could be trivial if set up correctly. The major cons would be no expressions and no type safety which I agree would be very nice. This was just a thought I had when working with the code generators.I think it will be hard to beat Xtend in this area, although I'm very open to suggestions...Xtend looks like it could work well. Scala's multi line strings / interpolation also isn't bad for adding expressions mid template.
I believe I posted some of it a long time ago I'll try to get an example later. Basically I added a way to easily add multiple where conditions using a builder.new UserDao(ctx).where().firstName("first").lastName("last").age(27)
I believe at the time you suggested exposing a way to just pass in a Condition quickly without some of the boilerplate.t is the user table objectnew UserDao(ctx).where(t -> t.FIRST_NAME.eq("first").and(t.LAST_NAME.eq("last")).and(t.AGE.between(min, max)))Something along those lines. It was just a quick way to skip a few lines of boilerplate .selectFrom's and mapping the objects back to pojos.
1. Target languages and formsjOOQ currently supports Java and Scala - the most popular languages on the JVM. Does it make sense to support other languages? Or perhaps even data formats, like XML?This is an interesting topic, but it is also very demanding in terms of complexity budget. Alternative languages cannot be integration tested as well as Java without adding substantial effort.That's fine for me. Closure would be nice, but those are two main JVM languages I'm really interested in. You could leverage things like protobuff to support more languages but honestly probably not worth the effort.
Not sure how XML would come into play. My favorite feature of Jooq is that I can point it to a database and generate source of truth so that the code reflects the data. XML (if we're using xml for data definition) would be a step backward, in my view. To each his own though.
2. Templating languageThe code generator currently uses a home-grown templating "language" via a home-grown, internal, undocumented API.In the past, users have suggested using Xtend (http://www.eclipse.org/xtend) instead. The advantage of Xtend is that the template language is built into the Xtend language, and it feels extremely natural.At the time, the idea of integrating Xtend was rejected, because the Xtend tooling was very Eclipse dependent. This is no longer true, and Xtend is still a very interesting consideration.Alternatively, a programmatic language model (like XJC has) could be interesting, although it would be very limiting in terms of what's possible in 1. Target languages.Aside from ease of use internally, is there any advantage to using any of these. As a simple user of Jooq, I don't think I would need to really interact with the particular templating unless you want to allow the user to override the default auto-gen code.
3. StyleProgrammers like endless discussions about curly braces, indentations, tabs and spaces. jOOQ currently doesn't embrace this sort of "creativity" :-)It would be great if the generated code style could be influenced in one way or another, although, this is a rather low priority.Irrelevant for autogen code IMO. Just follow the standard Oracle standard.
4. Generator strategiesMost customization is about naming style. Do you want your database objects in PascalCase? camelCase? UPPER_CASE? lower_case?Is this feature sufficient? What's missing here?I'm not sure if this is a Jooq specific or some library that Jooq is using .. but this does annoy me a good bit.
For example, I would have something like [...]
The fields 'magically' being converted from PARENT_ID to parentId is obnoxious. If the table names are auto-generated as parent_id then my constructor options should match the DB field names. There's something lost in translation where I'm retrieving a field named parent_id but the value intercept by the bean is parentId.
5. Disambiguation / compiler "optimisations"jOOQ code compiles almost always. We've thought of many edge-cases where generated code might cause conflict, e.g. because of naming ambiguity, invalid identifiers, etc. This is a must-have in any future implementation.I'm not sure how this could be addressed but I thought I'd point it out.we're using postgres and have multiple schemas, and in certain cases we operate on the same table on multiple schemas.Since we can't import both tables in the same class we end up with these odd inner classes.// Define Jooq Tables from the UI Schema private static class UI { protected static final com.foobar.package.ui.tables.Client CLIENT = com.foobar.package.ui.Tables.CLIENT; } private static class DATA { protected static final com.foobar.package.data.tables.Client CLIENT = com.foobar.package.data.Tables.CLIENT; }If you have a suggestion on a better pattern to use let me know, but it would be nice if the compiler took some override parameter to say add a prefix to the table name. so then I could just naturally export the UI_CLIENT table.
On Tue, Dec 29, 2015 at 11:27 AM, Lukas Eder <lukas...@gmail.com> wrote:
> 1. Target languages and forms
> 2. Tempting language
I think that (1) and (2) are intrinsically linked and hence are
difficult to treat separately.
For one thing, the code generator needs to not only produce source
that will compile or interpret given an arbitrary
compiler/interpreter, it also needs to conform to an ABI for the
runtime library of the given target language. For different language
frontons on the same platform (e.g. Scala and Java) you can re-target
more easily because you could re-use an single JOOQ runtime library.
Once you start targeting non-JVM stuff, then you either need port the
runtime or somehow transmogrify it (either by static code translation
or by some kind of foreign function invocation back to the original
JVM runtime).
You could take a half way house approach and define the semantics of
the ABI, but then, how would be able to verify that a given
implementation is protocol compliant. Sounds like you'd need a big
test suite. And then once you have that, you still need to make sure
your templates generate valid front end code, both for the target
language and the backend API.
That all said, maybe I've completely misunderstood JOOQ. In my mind
JOOQ essentially provides type safe SQL access, provided you are using
JDBC. Are there any non-JDBC JOOQ backends that can help invalidate my
assumption?
> 4. Generator strategies
Sounds like you're looking for a pluggable strategy abstraction that
can visit DB things and return a string?
> 5. Disambiguation / compiler "optimizations"
I've run into naming conflicts with legacy schemas before (e.g. DDL
with column names that differ just by case sensitivity alone, for
which JOOQ has produced non-compiling code.
That said, I was actually
glad that JOOQ blew up in this way, since it provided an easy check
that something was very wrong with the schema that we were hacking
into. In this situation I started by using the code generator config
to help me avoid the troublesome table, so in the first instance there
was no JOOQ access to this table. Then when I needed to read/write
to/from it, I created a view on the broken table that JOOQ would
compile against.
> 6. Custom code
> Currently, there are a few ad-hoc means of introducing custom code into
> generated artefacts. This is mostly done via method extension, which is
> rather limiting.
I've had to hook into the JavaGenerator class to override a method to
get the generator to play ball with the custom type binding I had
cooked up. But IMHO this could have been circumvented by allowing
application level access to the SQL type indexer in the compiler,
which is currently sealed off to members of the general public. So I
ended up hacking the generator just to achieve the effect of
registering a custom type.
I think maybe most of the questions about custom code relate to DAO
construction? If so, I'll have to back out of the discussion because I
haven't used the DAO side of JOOQ.
--
Hi,since we have a special chance to have our say :) I would like to mention about the thing which makes a little trouble now. Let's say I have a class WalletId. It's just a wrapper around String, VARCHAR in SQL. The trouble is, if I want to do a custom mapping for some columns in tables to use WalletId, I have to split the project to have two artifacts. So, instead of one POM, we need now 3: one for the WalletId class, second for the rest of the project and third, a parent for those two. In Microservices, when all the modules are really small, it is even more annoying.Question is: is it possible to mix the process of code generation with the project's compilation phase, so we could get the auto-generated code to use the types from that module itself?
Other things on my hypothetical wish list would be to support non-JDBC drivers. As we know the JDBC is a blocking API, but there are alternative drivers for some databases using async techniques. There is a lack of standardization in this area, but in my imaginary, perfect world :) the projects like jOOQ could try to change the JVM world in this area! OK, I was just thinking loudly :)
I won't even mention support for Clojure. Such a feature would cost a lot of time and I guess it would be doable by a 3rd parties if such a desire would emerge.
Hi Witold,Thank you very much for your feedback!2015-12-30 15:46 GMT+01:00 Witold Szczerba <witold...@gmail.com>:Hi,since we have a special chance to have our say :) I would like to mention about the thing which makes a little trouble now. Let's say I have a class WalletId. It's just a wrapper around String, VARCHAR in SQL. The trouble is, if I want to do a custom mapping for some columns in tables to use WalletId, I have to split the project to have two artifacts. So, instead of one POM, we need now 3: one for the WalletId class, second for the rest of the project and third, a parent for those two. In Microservices, when all the modules are really small, it is even more annoying.Question is: is it possible to mix the process of code generation with the project's compilation phase, so we could get the auto-generated code to use the types from that module itself?Sure, those types don't need to be compilation-ready while you generate your code. Unless, of course, you want to load the types in your own, custom code generator enhancement. But the code generator config only refers to types as fully qualified names (strings), so there's no dependency.The correct Maven phase for this would be generate-sources, or generate-test-sources.Or am I misunderstanding something?
Other things on my hypothetical wish list would be to support non-JDBC drivers. As we know the JDBC is a blocking API, but there are alternative drivers for some databases using async techniques. There is a lack of standardization in this area, but in my imaginary, perfect world :) the projects like jOOQ could try to change the JVM world in this area! OK, I was just thinking loudly :)This is on my wishlist, too :-) But it doesn't have anything to do with the code generator.
I won't even mention support for Clojure. Such a feature would cost a lot of time and I guess it would be doable by a 3rd parties if such a desire would emerge.Why not? It might be worth looking into. There is Suricatta, a third-party library that builds on top of jOOQ. Perhaps, the jOOQ code generator can be enhanced to also generate Clojure artefacts.
Most customisation is about naming style. Do you want your database objects in PascalCase? camelCase? UPPER_CASE? lower_case?Is this feature sufficient? What's missing here?
create.SELECT (AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, count()) .FROM (AUTHOR) .JOIN (BOOK).ON(AUTHOR.ID.equal(BOOK.AUTHOR_ID)) .WHERE (BOOK.LANGUAGE.eq("DE")) .AND (BOOK.PUBLISHED.gt(date("2008-01-01"))) .GROUP_BY (AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME) .HAVING (count().gt(5)) .ORDER_BY (AUTHOR.LAST_NAME.asc().nullsFirst()) .LIMIT (2) .OFFSET (1)My use of JOOQ is still very much that of a DBA doing some coding and so I would like the mapping between SQL scripts and Java code to be as near as possible.
I know its not very Java like, but uppercase is still the SQL way of writing statements. Also _ for spaces is clear than medial capitals (camelCase) if we are able to step away from Java 'standards'.
Most customisation is about naming style. Do you want your database objects in PascalCase? camelCase? UPPER_CASE? lower_case?Is this feature sufficient? What's missing here?
On Wed, Dec 30, 2015 at 12:34 PM, Lukas Eder <lukas...@gmail.com> wrote:
> No. Maybe in jOOQ 5.0 :-)
OK, cool - then this means that is fair to say that JOOQ is a JDBC
tool.
If that is the case I would like to see less assumptions being
made by the JOOQ runtime about how an app wants to interact with the
DB with a transaction. But in fairness, my comment is a bit off topic
- this thread is about the code generator, not the runtime.
> Interesting feedback. So, were you really missing something from the runtime
> library or from the code generator?
When I mentioned type index I was talking about the private maps
TYPES_BY_NAME, TYPES_BY_TYPE and TYPES_BY_SQL_DATATYPE which are all
immutable to the third party code during code generation and at
runtime.
What I'd like to be able to do is to write into these maps so
that
(a) I don't have to override JavaGenerator on a per-column basis to
shadow the output of these immutable indexes
(b) When I generate field references for complex queries at runtime,
that the DSL.field() call can be aware of my custom type - this is
another instance where the immutable type map leads to bogus SQL being
generated at runtime.
See my comments in-line:On Wed, Dec 30, 2015 at 6:16 PM, Lukas Eder <lukas...@gmail.com> wrote:Hi Witold,Thank you very much for your feedback!2015-12-30 15:46 GMT+01:00 Witold Szczerba <witold...@gmail.com>:Hi,since we have a special chance to have our say :) I would like to mention about the thing which makes a little trouble now. Let's say I have a class WalletId. It's just a wrapper around String, VARCHAR in SQL. The trouble is, if I want to do a custom mapping for some columns in tables to use WalletId, I have to split the project to have two artifacts. So, instead of one POM, we need now 3: one for the WalletId class, second for the rest of the project and third, a parent for those two. In Microservices, when all the modules are really small, it is even more annoying.Question is: is it possible to mix the process of code generation with the project's compilation phase, so we could get the auto-generated code to use the types from that module itself?Sure, those types don't need to be compilation-ready while you generate your code. Unless, of course, you want to load the types in your own, custom code generator enhancement. But the code generator config only refers to types as fully qualified names (strings), so there's no dependency.The correct Maven phase for this would be generate-sources, or generate-test-sources.Or am I misunderstanding something?Well, maybe I am misunderstanding something :)You say, that as of now, there is no need to create two separate artifacts? Let's say I have a project with two classes:WalletId and some MessageConsumer (it's just an example). MessageConsumer is intercepting a message and doing an SQL operation using code generated by jOOQ. This code, generated by jOOQ is supposed to use WalletId, so I customize the codegen mapper. Now codegen mapper wants WalletId class, but it is not available (it's not on any classpath), because the project was not build yet. On the other hand, the project cannot build, because it uses code generated by mapper.My current knowledge is that, as of now, I have to split my project to separate WalletId from MessageConsumer. At least this is how it was when I was starting using jOOQ few years ago. Has it changed?
Well, yes. It was not my intention to mix that with code generator "story" described earlier.
My biggest concern is that Clojure is a dynamic typing language and, this is only my initial though, it might not benefit that much from using code generator. Maybe I am wrong, because I am just at the very beginning of my "Clojure journey" :) I am still learning basics. It has a power, though! Those immutable (and only immutable, with no excuses) data structures are so... cool!Of course, jOOQ is not only a code generator. It's just a very nice API. It's JDBC as it meant to be!
In terms of an "easy way forward", none that I can see and I i know that your knowledge of what can be done in the java space is far greater than mine.
Well maybe a topic for 5.x then :)
Hi
I'm brand new to jOOQ, so maybe I'll be saying stupid stuff, don't hesitate to tell me if so.
Anyway, after having played with it various points came to me:
A - my need is for a brand new use case, without existing tables. To start from scratch is currently annoying. I need to create the tables and the like, using string constants for names, and then generate the model, and then update my tables creation script with the constants in the generated classes. Yet I'm coming from Java and, actually, some Java model of my domain. As such, it would be nice if, somehow, I could describe my tables and then have the pojo generated and as well a creation script. So basically I'm all for JPA annotations support, or something else if needs be (I'm unsure JPA "philosophy" fits with jOOQ "all of SQL" concept, but then one could complete the edge case on his own).
<database><name>org.jooq.util.jpa.JPADatabase</name><properties><property><!-- where your annotated entities are located --><key>packages</key><value>org.jooq.test.all.pojos.jpa</value></property></properties></database>
B - even without going as far as A, when the model is generated from DB it would be nice to have the creation script created too.
C - immutable POJO: I really like the peace of mind immutable objects provide. It would be awesome if I could tell the generator to create immutable pojos only.
<!-- Generate immutable POJOs for usage of the ResultQuery.fetchInto(Class) API This overrides any value set in <pojos/> Defaults to false --> <immutablePojos>false</immutablePojos>
Regarding your others questions :
1 - target languages, forms
IMHO the generated code is tightly coupled to the DSL itself. So to me it feels like the question is more about the whole lib than just the pojo. Still, being written in Java, it should be usable from most of the others JVM languages. Maybe going for an immutable approach would help for integration with Clojure or Scala code, but once again then is about the whole public API then, which is quite bigger from the generator itself.
For the others points, well, can't tell much apart from the obvious, so I'll skip ;)
Thanks a lot for jOOQ and hopefully it wasn't all nonsense!
On Thu, Dec 31, 2015 at 9:14 AM, Lukas Eder <lukas...@gmail.com> wrote:
> Yes, the thread will become a bit confusing, but I'm curious about your
> feedback anyway. Perhaps start a new thread? I think we still have some
> spare threads left on Google Groups ;-)
OK, I've done this.
> If I understand this correctly, we're still discussing the workaround that
> you implemented and that you'd like to improve. But what is the *use-case*?
> What are you trying to achieve and why doesn't it work right now?
The use case and workaround is described in the thread titled "Oracle
TIMESTAMP in UTC".
A - my need is for a brand new use case, without existing tables. To start from scratch is currently annoying. (snip)
There are two ways to look at this.1. From the dogmatic jOOQ philosophy point of view
(snip)
2. From a pragmatic "time-to-market" point of view
(snip)
B - even without going as far as A, when the model is generated from DB it would be nice to have the creation script created too.
Hmm, which creation script do you mean?
There is a pending feature request to re-generate the DDL from what the jOOQ runtime schema model knows about the underlying schema:This would be useful for those who like to duplicate a schema on H2 or some other in-memory database.
C - immutable POJO: I really like the peace of mind immutable objects provide. It would be awesome if I could tell the generator to create immutable pojos only.
Regarding your others questions :
1 - target languages, forms
IMHO the generated code is tightly coupled to the DSL itself. So to me it feels like the question is more about the whole lib than just the pojo. Still, being written in Java, it should be usable from most of the others JVM languages. Maybe going for an immutable approach would help for integration with Clojure or Scala code, but once again then is about the whole public API then, which is quite bigger from the generator itself.Indeed, but there are quick wins here. For instance, in Scala, a case class is more idiomatic than (yet, not that different from) a "POJO". Also, I'm still hoping that we're getting the Int vs. java.lang.Integer thing right, eventually (although there are some caveats)
Hi Lukas
Thx for your nice and thorough answer :)
Answers inline.
A - my need is for a brand new use case, without existing tables. To start from scratch is currently annoying. (snip)There are two ways to look at this.1. From the dogmatic jOOQ philosophy point of view(snip)2. From a pragmatic "time-to-market" point of view(snip)
to make it short : I fully agree. I thought of the hibernate generation upfront, but then the pojo wouldn't be of any help afterward, so it turned me off.
maybe I should explicit a bit more my pain point : when I write the first migration (or any migration adding new/changing stuff), I've to resort to strings. Which then are duplicates of the content in the generated model. This annoys me a bit in terms of "type safety" and more general usability: if I add the foo column in a migration, then going at the foo definition in the model and looking for usage/reference wouldn't show the string "foo" in the migration script. Bad. Currently I'm thinking of updating post model generation the migration script. Tedious, error prone and definitely not sexy ^^. So I'm looking for alternatives.
There is a pending feature request to re-generate the DDL from what the jOOQ runtime schema model knows about the underlying schema:This would be useful for those who like to duplicate a schema on H2 or some other in-memory database.
And to start using migration in a pre existing DB.
Or to replace the existing non type safe migration script with a type safe one. If I got your issue right, one could even dream of being able to say "generate me the whole DDL" or "generate the DDL for the delta between this schema and the previous one. Which would rock like hell :)
Actually to me it sounds pretty tricky impl wise, am I right?
C - immutable POJO: I really like the peace of mind immutable objects provide. It would be awesome if I could tell the generator to create immutable pojos only.(snip)
my bad ^^
Shouldn't immutable pojo be the default? ^^
Regarding your others questions :
1 - target languages, forms
IMHO the generated code is tightly coupled to the DSL itself. So to me it feels like the question is more about the whole lib than just the pojo. Still, being written in Java, it should be usable from most of the others JVM languages. Maybe going for an immutable approach would help for integration with Clojure or Scala code, but once again then is about the whole public API then, which is quite bigger from the generator itself.Indeed, but there are quick wins here. For instance, in Scala, a case class is more idiomatic than (yet, not that different from) a "POJO". Also, I'm still hoping that we're getting the Int vs. java.lang.Integer thing right, eventually (although there are some caveats)
Well, you're the judge here. I would prefer Query[] queries = ctx.ddl(mySchema); a thousand times, and scalaists just as well I guess ;)
On top, to do "anti corruption layer" is always a good practices and way easier in Scala, so maybe scalaist can wrap/bridge the way they want some nicely done pojos ;) I'm kidding to be honest. I would love case classes if using it in Scala.
What's the issue with Int vs. java.lang.Integer ?
Dear group,The jOOQ code generator is one of the biggest assets when using jOOQ. It allows for referring to your schema in a type safe way, allowing to leverage IDE auto completion with tables, columns, procedures, etc.However, it has grown organically and it thus doesn't allow for the extensibility that some of you would like. It is time to start thinking about the future of jOOQ-codegen and jOOQ-meta, to collect ideas for jOOQ 4.0 in that area, or perhaps even for prior releases. So, this is a good time to chime in and discuss potential requirements.The relevant issue is:These are, roughly, the existing features, or existing feature requests:1. Target languages and formsjOOQ currently supports Java and Scala - the most popular languages on the JVM. Does it make sense to support other languages? Or perhaps even data formats, like XML?This is an interesting topic, but it is also very demanding in terms of complexity budget. Alternative languages cannot be integration tested as well as Java without adding substantial effort.2. Templating languageThe code generator currently uses a home-grown templating "language" via a home-grown, internal, undocumented API.In the past, users have suggested using Xtend (http://www.eclipse.org/xtend) instead. The advantage of Xtend is that the template language is built into the Xtend language, and it feels extremely natural.At the time, the idea of integrating Xtend was rejected, because the Xtend tooling was very Eclipse dependent. This is no longer true, and Xtend is still a very interesting consideration.Alternatively, a programmatic language model (like XJC has) could be interesting, although it would be very limiting in terms of what's possible in 1. Target languages.3. StyleProgrammers like endless discussions about curly braces, indentations, tabs and spaces. jOOQ currently doesn't embrace this sort of "creativity" :-)It would be great if the generated code style could be influenced in one way or another, although, this is a rather low priority.
4. Generator strategiesMost customisation is about naming style. Do you want your database objects in PascalCase? camelCase? UPPER_CASE? lower_case?Is this feature sufficient? What's missing here?
1. code generation: would be great have more options about pojo generation. I.e. generate json-schema / json of tables or xml/xsd of tables. In some situations could be nice.
2. something more about xml /xpath /json queries type safeting. I don't know really how but of course db dependent...