The JPA spec (samples and interface Javadoc) eludes to the
<exclude-unlisted-classes/> stanza in the persistence unit definition means
to exclude unlisted classes in managed entity searches by the persistence

 <persistence-unit name="OrderManagement4" transaction-type=RESOURCE_LOCAL>
 ...... No (other) classes contained in the root of the persistence unit
are added to the list of managed persistence classes. .......


* @return Whether classes in the root of the persistence
* unit that have not been explicitly listed are to be
* included in the set of managed classes.
* This value corresponds to the <exclude-unlisted-classes>
* element in the persistence.xml file.
public boolean excludeUnlistedClasses();

However persistence_1_0.xsd's <exclude-unlisted-classes> has default value
to "false" and specifically said "When set to true then...."

<xsd:element name="exclude-unlisted-classes" type="xsd:boolean"
default="false" minOccurs="0">
When set to true then only listed classes and jars will
be scanned for persistent classes, otherwise the enclosing
jar or directory will also be scanned. Not applicable to
Java SE persistence units.

This means one can specify
<exclude-unlisted-classes>false</exclude-unlisted-classes> to NOT to exclude
unlisted classes. That is,

The 4 options of <exclude-unlisted-classes> are:
1)  not specifying at all   -->  NOT to exclude
2)  <exclude-unlisted-classes>false</exclude-unlisted-classes>  -->  NOT to
3)  <exclude-unlisted-classes>true</exclude-unlisted-classes>  -->  to
4)  <exclude-unlisted-classes/>   --> default to "false"  --> NOT to exclude

If this is the intention of the spec, <exclude-unlisted-classes/> syntax is
in contradiction to mean exclude unlisted classes semantics in the sample.
Should the schema default to "true"? Is this the correct interpretation? Or
what have I missed?

Albert Lee.

Reply via email to