[SOLVED] Deploying EAR fails on Singleton initialization with "create-tables" configuration
I'm getting the following error when deploying my EAR application. The issue appears to be that the MSSQL driver is throwing an exception when it attempts to CREATE a table that already exists in the database. IMO, this should prevent the container from creating an EntityManager for injection in the Singleton bean.
Here is the error:
Exception Occurred :Error occurred during deployment: Exception while loading the
app : javax.ejb.CreateException: Initialization failed for Singleton ApplicationBean.
Please see server.log for more details. PER01003: Deployment encountered SQL
Exceptions: PER01000: Got SQLException executing statement "CREATE TABLE ADDRESS
(ID NUMERIC(19) IDENTITY NOT NULL, ADDRESS1 VARCHAR(40) NOT NULL, ADDRESS2 VARCHAR(40)
NULL, ADDRESS3 VARCHAR(40) NULL, ADDRESSSTATE Char(2), CITY VARCHAR(20) NOT NULL,
COUNTY VARCHAR(20) NULL, ZIP4 Char(4), ZIP5 Char(5), PRIMARY KEY (ID))":
com.microsoft.sqlserver.jdbc.SQLServerException: There is already an object
named 'ADDRESS' in the database.
Here is part of my persistence.xml :
<property name="eclipselink.logging.level" value="SEVERE"/>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.jpa.uppercase-column-names" value="true"/>
Is there a fix for this, or a workaround that doesn't require me to change the ddl-generation type?