openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@bea.com>
Subject RE: <exclude-unlisted-classes> default value in persistence unit.
Date Mon, 20 Nov 2006 05:52:06 GMT
Yeah, this is a bit of an annoyance (and a bug) in the spec. Sadly, by
the time that the issue was identified, the spec team was unwilling /
unable to modify the spec to change it.

The problem is that the XSD says that the default is 'false', so if you
just '<exclude-unlisted-classes/>', the XSD says that that's the same as
<exclude-unlisted-classes>false</exclude-unlisted-classes>. IIRC, the
spec team decided that the XSD is most correct, even if undesired.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Albert Lee [mailto:allee8285@gmail.com] 
> Sent: Sunday, November 19, 2006 9:40 AM
> To: open-jpa-dev@incubator.apache.org; allee8285@hotmail.com
> Subject: <exclude-unlisted-classes> default value in persistence unit.
> 
> 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
View raw message