Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • I also tried by <property name="hibernate.hbm2ddl.auto">update</property> but it does not work Commented Nov 16, 2016 at 10:01
  • I guess your mapping tag is wrong, should be <mapping class="com.mycompany.testhibernate.Inventory"/> Commented Nov 16, 2016 at 10:05
  • public static void main( String[] args ) { AnnotationConfiguration config = new AnnotationConfiguration(); config.addAnnotatedClass(Inventory.class ); config.configure(); new SchemaExport(config).create(true, true); } When I run the following code from entity class I can create table in the database and delete the existing data from the table.but I do not want this. Commented Nov 16, 2016 at 11:15
  • Use SchemaUpdate update = new SchemaUpdate( configuration ); update.execute(...) Commented Nov 16, 2016 at 11:29
  • thanks to cralfaro,but your code will be : new SchemaUpdate(config).execute(true, true) excepting of new SchemaExport(config).create(true, true);; Commented Nov 17, 2016 at 3:30