Java Code Examples for org.hibernate.boot.MetadataSources#addFile()

The following examples show how to use org.hibernate.boot.MetadataSources#addFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MappingReference.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public void apply(MetadataSources metadataSources) {
	switch ( getType() ) {
		case RESOURCE: {
			metadataSources.addResource( getReference() );
			break;
		}
		case CLASS: {
			metadataSources.addAnnotatedClassName( getReference() );
			break;
		}
		case FILE: {
			metadataSources.addFile( getReference() );
			break;
		}
		case PACKAGE: {
			metadataSources.addPackage( getReference() );
			break;
		}
		case JAR: {
			metadataSources.addJar( new File( getReference() ) );
			break;
		}
	}
}
 
Example 2
Source File: SchemaBuilderUtility.java    From teiid-spring-boot with Apache License 2.0 5 votes vote down vote up
public void generateVBLSchema(ApplicationContext context, MetadataFactory source, MetadataFactory target,
        Dialect dialect, MetadataSources metadataSources) {
    generateVBLSchema(source, target);
    StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder(
            (BootstrapServiceRegistry) metadataSources.getServiceRegistry())
            .applySetting(AvailableSettings.DIALECT, dialect).build();
    ArtifactCollector files = generateHibernateModel(source, serviceRegistry);
    for (File f : files.getFiles("hbm.xml")) {
        metadataSources.addFile(f);
    }
}
 
Example 3
Source File: SchemaUpdateTask.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void configure(MetadataSources metadataSources) {
	for ( String filename : collectFiles() ) {
		if ( filename.endsWith( ".jar" ) ) {
			metadataSources.addJar( new File( filename ) );
		}
		else {
			metadataSources.addFile( filename );
		}
	}
}
 
Example 4
Source File: SchemaValidatorTask.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void configure(MetadataSources metadataSources) {
	for ( String filename : collectFiles() ) {
		if ( filename.endsWith(".jar") ) {
			metadataSources.addJar( new File( filename ) );
		}
		else {
			metadataSources.addFile( filename );
		}
	}
}