i am using MySql workbench and My Eclipse 8.6. and ma开发者_高级运维king a Hibernate-spring program. Is it possible to use reverse engineering feature in my eclipse with MySql workbench in so that DAO and hbm files can be generate like Derby. How can i do this with MySql workbench. this is a URL of using reverse engineering in my eclipse. http://www.myeclipseide.com/documentation/quickstarts/hibernateandspring/
I'm not sure about MyEclipe, but in Eclipse 3.6 you can install the "Hibernate Tools" for eclipse. Steps then are - create schema and tables using MySQL Workbench - in Eclipse, create a new Database Connection (Database Perspective --> Data Source Explorer View --> Database Connections, right-click, new). Specify MySQL driver, username password, database etc - make sure that Eclipse is then connected to the database, and can do a mysql ping to it - In Eclipse, create a new "JPA" project. - right-click on the JPA Project, and go to "JPA Tools" --> Generate Entities from Tables. - in the wizard, you need to change the mechanism for auto-assigning ID's to entities being written to the database
That's so much easy in Myeclipse just follow the steps:
- Open Hibernate Perspective.
- In DBbrowser window create new connection for database.
- Fill the details about mysql connection as asked, and save it.
- Now in DBbrowser start the connection you create.
- Open the connection hierarchy and select your table for which you want to make hibernate class.
- Right click on table name and select "Hibernate Reverse Engineering".
- Fill the details and select desired location and finish.
- It will generate all classes you want.
精彩评论