简体   繁体   中英

How to generate entity classes from database in java

I have been used to generating entity classes from database in .net. But recently i begun work on java and I have been looking for ways to do the same with hibernate or any other ORM tool. I havent yet found a way to do the same, all I find is that generate xml mappings or use java annotations.

Am i missing something here, it used to be a very easy approach in .net. You figure out your data model, create a database and then generate the entity classes using Entity Framework. It took care of generating classes for foreign key mappings as well.

In java, on the other hand, I have to manually map all the tables and their fields.

The DB reverse engineering plugin of Spring Roo, Spring Roo DBRE , can do this if Spring and Spring Roo would fit your needs. Generating foreign key mappings also worked good for me. Spring Roo also offers web scaffold generation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM