-
1. Re: Hibernate tools plugin
koen.aers Jun 5, 2012 9:45 AM (in response to mylos78)Hi Mylos,
It looks like either
1) you are not in the context of a project -> you should first create a project that will contain the generated entities
2) persistence is not set up for the project -> you need to issue 'persistence setup...' before generating the entities
The error message is not very helpful indeed... I'll do something about that.
Also, you can predefine datasources using the 'datasource' plugin. This one can be used outside the context of a project. It will be helpful to later on generate your entities as you can just specify the predefined datasource so the generate-entities command does not ask you the details of the connection over and over again.
I'll write up some more documentation for these plugins in the very near future.
Hope this helps!
Cheers,
Koen
-
2. Re: Hibernate tools plugin
mylos78 Jun 9, 2012 11:13 AM (in response to koen.aers)Thanks for your reply Koean,
well I've sorted out the issue which was due to an error in my proxy configuration (which prevented the hibernate plugin to get installed correctly)
Moving on, I've tried to reverse engineer my Oracle tables, but I've found the following error:
[as7forge] as7forge $ generate-entities --table Customer --driver oracle.jdbc.driver.OracleDriver --dialect org.hibernate.dialect.Oracle9Dialect
? Specify the URL for the JDBC connection. [jdbc:h2:tcp://localhost/sakila] jdbc:oracle:thin:@localhost:1521:ORACLE
? Enter the user name for JDBC connection. [null] scott
? Enter the password for JDBC connection. ******
? Enter the path in the local file system to the jar file containing the JDBC driver. [null] C:\forge-distribution-1.0.5.Final\lib\ojdbc14.jar
? In which package you'd like to generate the entities, or enter for default: [com.sample.model]
***ERROR*** An unexpected error happened during reverse engineering.
org.hibernate.cfg.JDBCBinderException: Duplicate class name 'com.sample.model.Syscatalog' generated for 'org.hibernate.mapping.Table(SYS.SYSCATALOG_)'. Same name where generated for 'org.hibernate.mapping.Table(SYS.SYSCATALOG_)'
at org.hibernate.cfg.JDBCBinder.createPersistentClasses(JDBCBinder.java:
173)
at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:94)
at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaData
Configuration.java:43)
at org.hibernate.forge.generate.GenerateEntitiesPlugin$2.run(GenerateEntitiesPlugin.java:514)
at org.hibernate.forge.generate.GenerateEntitiesPlugin.executeInNewUrlClassLoader(GenerateEntitiesPlugin.java:495)
at org.hibernate.forge.generate.GenerateEntitiesPlugin.doReverseEngineer
ing(GenerateEntitiesPlugin.java:506)
at org.hibernate.forge.generate.GenerateEntitiesPlugin.generateEntities(GenerateEntitiesPlugin.java:403)
I've tried also setting the --catalog and --schema option, however nothing worked for me.
Any help ?
Thanks
Mylos
-
3. Re: Hibernate tools plugin
koen.aers Jun 11, 2012 4:48 AM (in response to mylos78)Hi Mylos,
Shame on us! :-)
Apparently the filter options for tables, catalogs and schemas are never used by the plugin.
I'll work on that today.
Cheers,
Koen
-
4. Re: Hibernate tools plugin
f_marchioni Jun 12, 2012 7:02 AM (in response to koen.aers)Hi guys,
thanks for the great work @Forge. In case you might be interested, I've blogged about the Forge hibernate plugin here. Just one thing: I've hit a type mismatch on the Entity Primary key which is coded as Integer in Entity class and as Long in the view Bean class. Not tried on other DBs so I'm not sure if this issue is specific of MySQL.
Keep forging :-)
Francesco