openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee" <allee8...@gmail.com>
Subject <exclude-unlisted-classes> default value in persistence unit.
Date Sun, 19 Nov 2006 17:40:23 GMT
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
provider.

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

and

/**
* @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">
<xsd:annotation>
<xsd:documentation>
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.
</xsd:documentation>
</xsd:annotation>
</xsd:element>

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
exclude
3)  <exclude-unlisted-classes>true</exclude-unlisted-classes>  -->  to
exclude
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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message