Is there how I could programmatically ask eclipselink to drop and create all tables?

不羁岁月 提交于 2019-12-22 09:48:08

问题


This helps in unit testing.


回答1:


The following should work for you:

ServerSession session = entityManager.unwrap(ServerSession.class);  
SchemaManager schemaManager = new SchemaManager(session);  
schemaManager.replaceDefaultTables(true, true);



回答2:


One way to do that is to execute the sql scripts eclipselink generates specifying:

      <property name="eclipselink.ddl-generation.output-mode" value="both"/>

in persistence.xml



来源:https://stackoverflow.com/questions/3746572/is-there-how-i-could-programmatically-ask-eclipselink-to-drop-and-create-all-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!