[hibernate-dev] Passing a Scanner instance

Emmanuel Bernard emmanuel at hibernate.org
Mon Mar 22 10:45:16 EDT 2010


Anticipating Ales' work on the optimization between HEM and the micro container ( http://opensource.atlassian.com/projects/hibernate/browse/HHH-4191 ),

I've added a way to pass an instance of Scanner to the persistence unit:
 - an actual instance (recommended)
 - the class name of the instance to use

Use the hibernate.ejb.resource_scanner property name (HibernatePersistence.SCANNER)

In our case, the JPA deployer needs to add the following property

Map<String, Object> properties = new HashMap<String, Object>(1);
properties.put( HibernatePersistence.SCANNER, mcScannerInstance);
persistenceProvider.createContainerEntityManagerFactory(persistenceUnitInfo, properties);




I've also changed part of the  Scanner interface from

        /**
	 * return all files in the classpath (ie PU visibility) matching one of these file names
	 * if filePatterns is empty, return all files
	 * the use case is really exact file name.
	 */
	Set<NamedInputStream> getFilesInClasspath(URL jartoScan, Set<String> filePatterns);

to

       /**
	 * Return all files in the classpath (ie PU visibility) matching one of these file names
	 * if filePatterns is empty, return all files
	 * the use case is really exact file name.
	 *
	 * NOT USED by HEM at the moment. We use exact file search via getResourceAsStream for now.
	 */
	Set<NamedInputStream> getFilesInClasspath(Set<String> filePatterns);





More information about the hibernate-dev mailing list