Pavel Buzek's Weblog

All | JavaEE5 | netbeans
« Automatic Generation... | Main | Next Step: Generate... »
20060127 e premte janar 27, 2006

Generate entity classes from DB


The last entry was about auto generation of DB tables for entity classes in Glassfish. Now, in turn, we have something cool to show you in NetBeans JavaEE 5 build. We have implemented a wizard that generates entity classes from existing database tables. The generator calculates closure of tables based on foreign keys. It generates nice Java friendly names, for example if the database has "CUSTOMER_ID" it will use getCustomerId() for the getter and uses mapping annotations, e.g. @Column(name = "CUSTOMER_ID", nullable = false). It also generates annotations for all relationships, etc.

A picture is worth thousand words:

Get a build of Java EE 5 (see the link in the up right corner) and test it on your database. Send feedback or file bugz. Thanks.


( Jan 27 2006, 02:13:12 PD EST ) Permalink Comments [2]

Comments:

Good, good and expected ! 1) What we expect aswell is to handle column-adding. - Let say we've added a column (on a already generated table) - It should appear as 'non selected' and when selected - The wizard would only make the necessary update AFA this/these column(s) are concerned 2) column delete should be handled : - they should appear as deleted - ...

Posted by sse on janar 27, 2006 at 10:30 PD EST #

It needs to allow you to pick the classname and method names instead of guessing for you. It also generates duplicate classes if you refactored the object name. It should use the table name annotation not the classname for dup checking. It would also be nice to be able to edit relationships prior to generation. ie leave out a relationship, set load styles and direction. Thanks for all of the hard work, this is a MAJOR feature in my opion. Good work.

Posted by James Nelson on janar 28, 2006 at 01:16 PD EST #

Post a Comment:

Comments are closed for this entry.
Download NetBeans IDE

Calendar

RSS Feeds

Recent Entries

Blogs

Search

Navigation

Referers