开发者

How to disable sql creation for JPA entity classes

开发者 https://www.devze.com 2023-01-03 11:18 出处:网络
We have some JPA entity classes which are currently under development and wouldn\'t want them as part of the testing cycle. We tried commenting out the relevant entity classes in META-INF\\persistence

We have some JPA entity classes which are currently under development and wouldn't want them as part of the testing cycle. We tried commenting out the relevant entity classes in META-INF\persistence.xml but the hbm2ddl reverse engineering tool still seems to generate SQL for those entities. How do I tell my code to ignore these classes? Are there any annotations for these or should I have to comment out th开发者_如何学JAVAe @Entity annotation along with my changes in persistence.xml file.


JPA automatically scans your classpath for entities. So one option, as you say, is to remove the @Entity annotation. Another option is to use <exclude-unlisted-classes>true</exclude-unlisted-classes> which will cause only the listed classes in persistence.xml to be used.

0

精彩评论

暂无评论...
验证码 换一张
取 消