
com.myjavadoc.hibernate4.configuration.JPAComponentConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate4-maven-plugin
Show all versions of hibernate4-maven-plugin
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.hibernate.cfg.Configuration;
//import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.ejb.HibernatePersistence;
import org.hibernate.HibernateException;
import java.util.HashMap;
import java.util.Map;
public class JPAComponentConfiguration
extends AbstractComponentConfiguration
{
// --------------------- Interface ComponentConfiguration ---------------------
public String getName()
{
return "jpaconfiguration";
}
protected Configuration createConfiguration()
{
String persistenceUnit = getExporterMojo().getComponentProperty( "persistenceunit" );
try
{
//Ejb3Configuration ejb3cfg = new Ejb3Configuration();
// if ( ejb3cfg.configure( persistenceUnit, getMappedProperties() ) == null )
// {
// getExporterMojo().getLog().error( "Persistence unit not found: '" + persistenceUnit + "'." );
// return null;
// }
// return ejb3cfg.getHibernateConfiguration();
return null;
}
catch ( HibernateException he )
{
getExporterMojo().getLog().error( he.getMessage() );
return null;
}
}
private Map getMappedProperties()
{
Map map = new HashMap();
String namingStrategy = getExporterMojo().getComponentProperty( "namingstrategy" );
if ( namingStrategy != null )
{
map.put( HibernatePersistence.NAMING_STRATEGY, namingStrategy );
}
return map;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy