Multiple jars, single persistence unit solution?

送分小仙女□ 提交于 2019-12-02 16:45:19

Yes, this is allowed by the JPA specification.

XML entity mappings are designed to override JPA annotations. Unless you specifically change the default behavior using <xml-mapping-metadata-complete/> tag, JPA provider will use annotations where there is no XML mapping.

Here is an excerpt from the JPA 2.0 spec:

12.1 Use of the XML Descriptor

... The absence or present of the xml-mapping-metadata-complete subelement contained in the persistence-unit-defaults subelement of the entity-mappings element controls whether the XML object/relational mapping descriptor is used to selectively override annotation values or whether it serves as a complete alternative to Java language metadata annotations.

If the xml-mapping-metadata-complete subelement is specified, the complete set of mapping metadata for the persistence unit is contained in the XML mapping files for the persistence unit, and any persistence annotations on the classes are ignored.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!