java 非xml实体类_java-在persistence.xml之外定义jpa实体类

6.2.1.6 mapping-file, jar-file, class, exclude-unlisted-classes

The following classes must be

implicitly or explicitly denoted as

managed persistence classes to be

included within a persistence unit:

entity classes; embeddable classes;

mapped superclasses.

The set of managed persistence classes

that are managed by a persistence unit

is defined by using one or more of the

following:

One or more object/relational mapping XML files

One or more jar files that will be searched for classes

An explicit list of the classes

The annotated managed persistence classes contained in the root of the

persistence unit (unless the

exclude-unlisted-classes element is

specified)

(…)

A list of named managed persistence

classes may also be specified instead

of, or in addition to, the JAR files

and mapping files. Any mapping

metadata annotations found on these

classes will be processed, or they

will be mapped using the mapping

annotation defaults. The class element

is used to list a managed persistence

class. A list of all named managed

persistence classes must be specified

in Java SE environments to insure

portability. Portable Java SE

applications should not rely on the

other mechanisms described here to

specify the managed persistence

classes of a persistence unit.

Persistence providers may also require

that the set of entity classes and

classes that are to be managed must be

fully enumerated in each of the

persistence.xml files in Java SE

environments.

All classes contained in the root of

the persistence unit are also searched

for annotated managed persistence

classes and any mapping metadata

annotations found on them will be

processed, or they will be mapped

using the mapping annotation defaults.

If it is not intended that the

annotated persistence classes

contained in the root of the

persistence unit be included in the

persistence unit, the

exclude-unlisted-classes element

should be used. The

exclude-unlisted-classes element is

not intended for use in Java SE

environments.

The resulting set of entities managed

by the persistence unit is the union

of these sources, with the mapping

metadata annotations (or annotation

defaults) for any given class being

overridden by the XML mapping

information file if there are both

annotations as well as XML mappings

for that class. The minimum portable

level of overriding is at the level of

the persistent field or property.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值