How to remove/hide unnecessary Session Factories (picked up from a dependent JAR file) from the Persistence view?


After adding Hibernate Facet to an existing module with Spring configuration, I found unexpected Session Factories shown in the Persistence view. Half of the factories belong to the current module (i.e. they are defined in the current module's Spring config XML), another part is picked up from the Spring configuration of a dependent JAR. Need to note, that session factories of the current module extend (i.e. use as a "parent") abstract factories from the dependent JAR. In addition, dependent JAR has multiple non-abstract factories definition as well. I think this causes IDEA to display both set of factories...

How I can add a filter to the searched Session Factory locations or remove not needed factories from the Persistent view? In my case IDEA doesn't allow me to remove "top-level" factories, because config file is located in the "external" JAR file. I reviewed "Spring Application Context" module's configuration, i.e. click "Edit" and make sure that dependent JAR is NOT selected. If it is not a bug, IMO the described behavior is confusing (I would allow to customize/filter displayed list of entities at least).

BTW, found old post that describes similar confguration (see post from Thibaut):

Thanks for assistence,

Comment actions Permalink

Update: I have been trying to workaround this behavior in different ways, i.e. remove/add Spring config XMLs of the dependent JAR to the module's Spring Application Context, remove/add non-abstract factories declaration in the Spring XML of the denendent JAR file "on the fly", remove/add Hibernate facet from/to the module between attemps. After all, I've restarted IDEA and now ... it does NOT show Session Factories from the dependent JAR! I know it sounds weird, but it is what it is... :^O

I still think there is some floating bug in this area, but I am settled now, so resloving my question.

Comment actions Permalink

Update#2: I needed to reimport the module, and faced this problem again :^O Second time I was not able to "workaround" it, so created


Please sign in to leave a comment.