All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.myjavadoc.hibernate4.configuration.DefaultComponentConfiguration Maven / Gradle / Ivy

Go to download

Hibernate 4 maven plugin, run hibernate tools from inside maven builds. Based off Codehaus hibernate3-maven-plugin 2.2. The configuration is the same but the performance is alot better. See source for example database reverse engineering to JPA.

The newest version!
package com.myjavadoc.hibernate4.configuration;

import org.codehaus.plexus.component.annotations.Component;
import org.hibernate.cfg.Configuration;

import java.io.File;

@Component( role = ComponentConfiguration.class)
public class DefaultComponentConfiguration
    extends AbstractComponentConfiguration
{
// --------------------- Interface ComponentConfiguration ---------------------

    public String getName()
    {
        return "configuration";
    }

    protected Configuration createConfiguration()
    {
        return new Configuration();
    }

    protected void doConfiguration( Configuration configuration )
    {
        super.doConfiguration( configuration );

        // if the mojo has the scan-classes flag on then scna the output directories for hbm.xml files
        if ( getExporterMojo().getComponentProperty( "scan-classes", false ) )
        {
            // add the output directory
            File outputDirectory = new File( getExporterMojo().getProject().getBuild().getOutputDirectory() );
            if ( outputDirectory.exists() && outputDirectory.isDirectory() )
            {
                configuration.addDirectory( outputDirectory );
            }

            File testOutputDirectory = new File( getExporterMojo().getProject().getBuild().getTestOutputDirectory() );
            if ( testOutputDirectory.exists() && testOutputDirectory.isDirectory() )
            {
                configuration.addDirectory( testOutputDirectory );
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy