开发者

exclude @Entity from persistence

I am using persistence.xml in hibernate

However, I am some @Entity in the classpath which I don't 开发者_运维技巧them to be part of persistence.xml.

in the documentation

class The class element specifies a fully qualified class name that you will map. By default all properly annotated classes and all hbm.xml files found inside the archive are added to the persistence unit configuration.

Is there to exclude some entities from it?


It's not possible afaik. But don't worry about that - if you don't use these classes they will not bother you, apart from their metadata being loaded by the session factory.

Update: hbm2ddl tools (like ant) have the excludes option. I don't know how you are using it, so search for options there.

Apart from this, you can manually list all classes in persistence.xml and use:

<exclude-unlisted-classes>true</exclude-unlisted-classes>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜