java - Can I automatically update Hibernate pojos and mappings in Netbeans after adding a new table? -


I have hibernate mapping files and pods created by Netbeen, for which I've added the named query and additional methods.

Now I have added the database and a foreign key column to an existing table.

To add mapping to hand, there is not a big problem in just one table, but it becomes tedious and more prone to error.

What I'm doing at the moment uses a wizard to create a new set of new sections and mapping in a new package and manually merge them, which itself is prone to mistakes

Is there any way to update .hbm and java files automatically?

What is the best way to keep the database and hibernate in sync, what you are trying to achieve is not. If possible, you should be surrounded in another way - should be in hibernation and change them in the mapping and they should be visible in the database.

After all, this is your object model, which is not a database representation. / P>

hibernate.hbm2ddl.auto check the property. If set to update , then it will update the underlying database with appropriate columns and constraints based on the changes in your hibernate mapping.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -