I'm using import.sql successfully in an ejb.jar together with JPA. In my persistence.xml I've configured autoddl to 'create'. So when the table doesn't exist, it will be created and data from import.sql will be imported without any problems. If the table already exists, nothing happens - as expected.
Now this ejb.jar is bundled with other ejb.jars in an EAR. All other ejb.jars use also JPA with autoddl set to create but without an import.sql itself.
Now it happens that on deployment of the EAR, _everytime_ the import.sql is executed n times (n=for each ejb.jar) which leads to errors because IDs already exist in db from the first execution of the import.sql.
Two things I can't explain:
a) why is the import.sql executed although all tables exist? b) why is the import.sql executed n times, although it exists only on the classpath of the first ejb.jar?
Adding an additional empty import.sql of one of the other ejb.jars leads to no import and no errors messages.
It seems that the autoddl has a problem with classloading?!
I'm using JBoss 5.1.0.
Any hints?
|