Automatically create Entities from database
Is there a way to automatically create javax.persistence.Entity classes from an existing database (or from the SQL statements that created them)?
I am just reading through the persistence part of The Java EE 5 Tutorial and creati开发者_Go百科ng all these annotations by hand seems rather wasteful considering that all (or most) of the necessary knowledge is already encoded in the database or even explicitly given in the form of SQL statements.
There are several attemps to reverse engineer databases to create entity classes, one of the first google results show this blog, but you can find quite a lot information. Also if you are going to use hibernate, check for ddl2hbm tools, what basically is the very same idea.
精彩评论