Multiple jars, single persistence unit solution?

后端 未结 1 837
广开言路
广开言路 2021-01-31 04:51

Some people, including me, have been struggling with merging entities from different modules (jars) into a single persistence unit (especially with JavaSE, for

相关标签:
1条回答
  • 2021-01-31 05:26

    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.

    0 讨论(0)
提交回复
热议问题