0

we have two standalone web projects need to share same entities , so we create one project for entities and use maven to make sure the two web projects can refer to the entities correctly, but when we try to deploy the web project with tomcat we found the database tables can NOT be generated by JPA , and if we copy all the related entities to each web project it works fine. the entity project will output entity.jar which include all entity classes and will be included in each web project , just like refer any 3p jar. i am really confused abt this and what i am suspecting is if tomcat should load the entity.jar earlier than other classes or we need to re-write classloader to fix this . this issue have blocked us whole day and there are less info on website for this specified issue , thanks very much .

Stone
  • 1
  • 1
  • How are you deploying your jar on tomcat? I would use an application server for this like GlassFish or WildFly and deploy the jar file as an EJB project. – Martijn Burger Jan 13 '15 at 09:50
  • Could you please provide more details about your configuration (which JPA implementation, which configuration in your persistence.xml) ? – bdulac Jan 13 '15 at 12:13
  • This is not a standard JPA function. However, as explained in [this exchange](http://stackoverflow.com/questions/5992031/generate-ddl-for-jpa-2-0-with-eclipselink), EclipseLink (the reference JPA implementation) supports such a mode. An [official documentation](http://eclipse.org/eclipselink/documentation/2.5/jpa/extensions/p_ddl_generation.htm) is available. [Here](http://www.disasterarea.co.uk/blog/generate-database-schema-ddl-from-hibernate-hbm-mappings/) is a tutorial for Hibernate. For other implementations, you should refer to the documentation. – bdulac Jan 13 '15 at 12:14
  • thanks all of you! we have fixed this issue by adding the specified jar element in persistence.xml – Stone Jan 15 '15 at 02:17

0 Answers0