H2Database db = new H2Db(entityClasses).getDb();
delegate.setTargetDirectory(config.getExportPath());
delegate.setTargetPackage(pkg);
db.setIncludes(new String[] { ".*" });
db.setExcludes(new String[0]);
db.setRecordVersionFields(new String[0]);
db.setRecordTimestampFields(new String[0]);
db.setSchemaVersionProvider(new ConstantSchemaVersionProvider("1"));
db.setConfiguredEnumTypes(new ArrayList<EnumType>());
db.setConfiguredForcedTypes(new ArrayList<ForcedType>());
db.setConfiguredCustomTypes(new ArrayList<CustomType>());
List<Schema> schemas = new ArrayList<Schema>();
schemas.add(new Schema().withInputSchema("codegen").withOutputSchema("Generated"));
db.setConfiguredSchemata(schemas);
delegate.generate(db);
Hello JOOQ Folks,I'm having a bit of trouble with the code generation in JOOQ and I'm a little unsure of what I'm doing wrong. I'm trying to build a library that scans our JPA entities, and does code generation on them. I created my own generator that intercepts the generate(Database) call, scans the classpath for JPA entities, builds an H2 schema out of them with hibernates ddl tools, creates an H2 database and populates it with the schema, and pipes that to a delegate JavaGenerator. I realize what I'm doing isn't super common so if I'm just not using JOOQ in a way it can be used, please let me know, I'm using both 3.5.3 for the core jooq modules and codegen.
The issue I'm having is that the generated code is trying to reference a static field on the generated table entity, when the actual field it should be hitting is on a singleton on that generated entity. From looking inside the JavaGenerator I don't think it's building the field access quite correctly, but I'm not sure if that's an artifact of what I'm doing.
Here's where I generate the code, and attached is the generated source. I can provide the schema inside H2 if that is helpful as well. Apologies for the weird formatting.
//just a helper class that does the schema export into a h2 db
H2Database db = new H2Db(entityClasses).getDb();
delegate.setTargetDirectory(config.getExportPath());
delegate.setTargetPackage(pkg);
db.setIncludes(new String[] { ".*" });
db.setExcludes(new String[0]);
db.setRecordVersionFields(new String[0]);
db.setRecordTimestampFields(new String[0]);
db.setSchemaVersionProvider(new ConstantSchemaVersionProvider("1"));
db.setConfiguredEnumTypes(new ArrayList<EnumType>());
db.setConfiguredForcedTypes(new ArrayList<ForcedType>());
db.setConfiguredCustomTypes(new ArrayList<CustomType>());
List<Schema> schemas = new ArrayList<Schema>();
schemas.add(new Schema().withInputSchema("codegen").withOutputSchema("Generated"));
db.setConfiguredSchemata(schemas);
delegate.generate(db);
Please let me know if there's any additional context I should provide. Thanks.
--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.
--