Question

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 the @Entity annotation along with my changes in persistence.xml file.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top