{
try {
BufferedReader br = currentProject.getBufferedReader( fileName );
// get the mapping file content
XmlElement rootXml = xmlParser.parse( br );
// get the name of the package containing the mapped classes
String packageName = rootXml.getAttribute( "package" );
if ( packageName == null )
return;
// read the entity definitions
Enumeration enumClasses = rootXml.getChildren().elements();
while ( enumClasses.hasMoreElements() ) {
// read the configuration of a single class
XmlElement classXml = (XmlElement)enumClasses.nextElement();
if ( !"class".equals( classXml.getName() ))
continue;
String className = ( packageName + "." + classXml.getAttribute( "name" ));
// iterate over the properties of a class
Enumeration enumProperties = classXml.getChildren().elements();
while ( enumProperties.hasMoreElements() ) {
// read the property configuration
XmlElement propertyXml = (XmlElement)enumProperties.nextElement();
// check whether the xml node defines a "lazy" collection
if ( isLazyCollection( propertyXml )) {
// mark that the collection is lazily initialized
String propertyName = propertyXml.getAttribute( "name" );
List properties = (List)hibernateConfiguration.get( className );
if ( properties == null )
hibernateConfiguration.put( className, properties = new ArrayList() );
properties.add( propertyName );
}