Create a Web project, use Hibernate, create an entity class in a project it's too much trouble to waste time, now teach you how to use MyEclipse to automatically generate Hibernate mapping files and entities
Method/Step
- Create a database, create the appropriate table
- Click on the icon to select MyEclipse datebase Explorer
- Right-click an empty area, choose the New menu, follow the prompts to create a database connection, create the connection name you created, MYSQLDB is the database connection I created
- Select the project where you want to add the Hibernate image file right-click--->myeclipse-->add Hibernate capabilities
- Prompt, as prompted next, no need to change things
- When prompted, select the database connection name you just created, continue to the next step, and finally finish
- Just auto-generated things that have Hibernatesessionfactory.java and Hibernate.cfg.xml
- To the newly created database connection in MyEclipse datebase Explorer Select all tables, right-click--->hibernate Reverse enginnering Select Directory to hold the entity class that will be reversed to see if update is selected Hibernate configuration. If you do not check it yourself, next, you can set the ID growth method per table (assigned for the designation, in order to facilitate the system to make the decision ), and the resulting mapping file name considerations: the Class Name to specify the full package name assigned represents dignitaries for designation, in order to facilitate can be left blank to let the system decide
- Back to my Eclipse Enterprise view, all entity classes and configuration files have been generated
Automatically generate hibernate mapping files and entity classes with MyEclipse