Hello,
I'm trying to use jpagen for one of my small projects but every time I got the same error:
11:32:31,063 INFO ~ MLog clients using log4j logging.
11:32:31,339 INFO ~ templateFile: list.tmpl
11:32:32,710 ERROR ~ null
java.lang.NullPointerException
at play.modules.jpagen.ListGenerator.main(ListGenerator.java:64)
I read the documentation again and again and seems everything was right, all the required properties are there. So I went to debugging to find out. While debugging I realize that the error was because I haven't set a value for the "db.default.schema" property. When I did everything worked just fine. I think you can solve this issue by two ways; updating the documentation and define "db.default.schema" as required or change the code to really accept it as empty property:
I also did the second one, my one cent contribution is below:
I commented the following lines:
>46: //if (temp.length() > 1) {
47: schemas = temp.split(",");
>48: //}
and also including this:
>72: if(schema.length()>0)
73: table = schema + "." + rs.getString("TABLE_NAME").trim();
>74: else
>75: table = rs.getString("TABLE_NAME").trim();
With this little and dirt mod the "db.default.schema" property can be empty.
Another changing I made was in the Generator. My tables are all capitalized like BASE_SOFTWARE then the generated class was capitalized too, like BASESOFTWARE. So I changed the following line:
182: column.columnPropertyName = JavaExtensions.camelCase(column.columnName.replaceAll("_", " "));
by this one:
182: column.columnPropertyName = JavaExtensions.camelCase(column.columnName.toLowerCase().replaceAll("_", " "));
And then the generated class was named BaseSoftware.
Forgive me if I was not clear, English is not my primary language.
Thank you for this module.