Hibernate tries to recreate previously created tables

Description

Dear Hibernate team,

I encouter a problem with hibernate when javax.persistence.schema-generation.database.action=create is enable. Hibernate try to (re)create a previously created table during database schema generation.

Below, my step that raised the bug :
1) I check if my postgresql database is fully empty;
2) I build my EAR. I use OpenEJB+Hibernate+JUnit for my tests cases without errors (not same properties);
2) I pull my EAR to WildFly through Netbeans. I obtain this output :

Maven output

------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.342s
Finished at: Fri Aug 08 19:57:17 CEST 2014
Final Memory: 6M/15M
------------------------------------------------------------------------
NetBeans: Deploying on WildFly Application Server 8.1.0
profile mode: false
debug mode: false
force redeploy: true
Initial deploying EAR to E:\WildFly\8.1.0\standalone\deployments\obyon-ear-1.0.ear
Completed initial distribution of EAR
Deploying E:\WildFly\8.1.0\standalone\deployments\obyon-ear-1.0.ear
{"JBAS014671: Failed services" => {
"jboss.persistenceunit.\"obyon-ear-1.0.ear/obyon-portal-1.0.war#obyon\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"obyon-ear-1.0.ear/obyon-portal-1.0.war#obyon\":

javax.persistence.PersistenceException: Unable to execute JPA schema generation create command [create table CATEGORYS (id bigserial not null, visible boolean not null, primary key (id))]
Caused by: javax.persistence.PersistenceException: Unable to execute JPA schema generation create command [create table CATEGORYS (id bigserial not null, visible boolean not null, primary key (id))]
Caused by: org.postgresql.util.PSQLException: ERREUR: la relation « categorys » existe déjà",
"jboss.persistenceunit.\"obyon-ear-1.0.ear#obyon\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"obyon-ear-1.0.ear#obyon\": javax.persistence.PersistenceException: Unable to execute JPA schema

generation create command [create table CATEGORYS (id bigserial not null, visible boolean not null, primary key (id))]
Caused by: javax.persistence.PersistenceException: Unable to execute JPA schema generation create command [create table CATEGORYS (id bigserial not null, visible boolean not null, primary key (id))]
Caused by: org.postgresql.util.PSQLException: ERREUR: la relation « categorys » existe déjà"
}}

3) I check the generated database tables/relationships, everything is okay.

Database seems good, but the generated error abort the EAR deployement.

Below, my persistence.xml :

I will provide a test case ASAP

Environment

Windows 7 32Bits
WildFly 8.1.0 Final
PostgreSQL 9.3

Status

Assignee

Unassigned

Reporter

Guillaume Chauvet

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure