JBoss Community

Re: Persistence provider creating new table even with update option

created by Mitesh pandey in EJB3 - View the full discussion

Hi All,

 

On running jboss server i have a message

 

................

................

[AnnotationBinder] Binding entity from annotated class: com.domain.Cabin

[EntityBinder] Bind entity com.domain.Cabin on table Cabin

[AnnotationBinder] Binding entity from annotated class: com.domain.Address

[EntityBinder] Bind entity com.domain.Address on table Address

[AnnotationBinder] Binding entity from annotated class: com.domain.Customer

[EntityBinder] Bind entity com.domain.Customer on table Customer

.......................

.......................

[SchemaUpdate] Running hbm2ddl schema update

  [SchemaUpdate] fetching database metadata

  [SchemaUpdate] updating schema

  [TableMetadata] table found: public.address

  [TableMetadata] columns: [zip, address_id, street, state, city]

[TableMetadata] foreign keys: []

  [TableMetadata] indexes: [address_pkey]

[TableMetadata] table found: public.cabin

  [TableMetadata] columns: [id, ship_id, bed_count, name, deck_level]

[TableMetadata] foreign keys: []

  [TableMetadata] indexes: [cabin_pkey]

  [TableMetadata] table found: public.customer

  [TableMetadata] foreign keys: [fk27fbe3fe861439fd]

  [TableMetadata] indexes: [customer_pkey]

  [SchemaUpdate] schema update complete

 

I googled and learnt that the update option basically update the DB schema. At one place it is binding my entity classes with the table in my DB and then while updating schema it has created new table.

 

And when i tried running the test application by commenting

<property name="hibernate.hbm2ddl.auto" value="update" />

 

my jboss was up with entity binding successfull but updation failed with below error

 

org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update which was expected.

 

I m clueless.

Reply to this message by going to Community

Start a new discussion in EJB3 at Community