If the only changes to your schema are within existing tables, you're in luck, as you can just open the "META-INF" folder, right click on the schema, and choose "Recapture Schema from Database". After doing this, make sure to rebuild the project ("Build" --> "Build Main Project" from the top menu). Now the new schema info will be available in beans binding menus, etc.
However, the only way I could figure out how to change a schema that involves a new table is to create a new schema, delete the old one, and modify any code that references the old schema. "Recapture..." does not retrieve new tables, and there's no way I could find to actually edit the schema, without diving into the XML code (I've seen it - it's not worth it, and I'm not usually afraid to edit complex XML).
To create a new schema, right click on the "META-INF" folder, and select "New" --> "Other..." --> select the "Persistence" folder, and "Database Schema". Name it, select your database, select the tables you want to add. Next, either manually edit or delete and re-create any Entity Classes. Rebuild the project, and you're set.
I assume/hope an "Edit Schema" function is coming to NetBeans someday soon. "Update Entity Class" would be nice, too.
1 comment:
hello, have a look on this link
http://www.netbeans.org/kb/docs/java/gui-db.html
Post a Comment