java - Including only individual entities in Spring Boot JPA Test -


i trying test jpa queries in separate projects entities kicking off spring boot project generate platform insert data h2 database, run queries against it, , validate results of these queries.

because separate project has large entity base, i'd selectively pick out entities want per test.

i've tried use @entityscan annotation this, seems designed pull entire packages, if specify class.

this strikes me there must solution for, have far been unable find it.

the thing when set test class spring context, context exists tests in class, unless use @dirtiescontext or other trick make rebuild itself.

@entityscan(basepackageclasses = myentity.class) 

the code above doesn't tell spring use myentity, tells start searching entities in package myentity exists in. recursively, if have instance:

com.example.entities.myentity com.example.entities.subpackage.myotherentity 

it pick both myentity and myotherentity. if, however, wrote entityscan this:

@entityscan(basepackageclasses = myotherentity.class) 

then myentity not found.

with in mind, suggestion have perhaps group large number of entities multiple smaller subpackages make easier load, if loading of them @ once indeed showstopper you.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -