Author: max.andersen(a)jboss.com
Date: 2006-11-14 08:06:36 -0500 (Tue, 14 Nov 2006)
New Revision: 10802
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/ConfigurationTask.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/GenericExporterTask.java
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/JPAConfigurationTask.java
Log:
hbmtemplate is a bit more informative now when running.
jpaconfiguration now supports entityresolver
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/ConfigurationTask.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/ConfigurationTask.java 2006-11-14
13:04:45 UTC (rev 10801)
+++
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/ConfigurationTask.java 2006-11-14
13:06:36 UTC (rev 10802)
@@ -35,7 +35,7 @@
private Configuration cfg;
private File configurationFile;
private File propertyFile;
- private String entityResolver;
+ protected String entityResolver;
private String namingStrategy;
public ConfigurationTask() {
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/GenericExporterTask.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/GenericExporterTask.java 2006-11-14
13:04:45 UTC (rev 10801)
+++
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/GenericExporterTask.java 2006-11-14
13:06:36 UTC (rev 10802)
@@ -69,6 +69,13 @@
}
public String getName() {
- return "generic exporter " + ((exporterClass==null) ? "" :
exporterClass);
+ StringBuffer buf = new StringBuffer("generic exporter");
+ if(exporterClass!=null) {
+ buf.append( "class: " + exporterClass);
+ }
+ if(templateName!=null) {
+ buf.append( "template: " + templateName);
+ }
+ return buf.toString();
}
}
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/JPAConfigurationTask.java
===================================================================
---
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/JPAConfigurationTask.java 2006-11-14
13:04:45 UTC (rev 10801)
+++
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/ant/JPAConfigurationTask.java 2006-11-14
13:06:36 UTC (rev 10802)
@@ -9,6 +9,7 @@
import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration;
import org.hibernate.util.ReflectHelper;
+import org.xml.sax.EntityResolver;
public class JPAConfigurationTask extends ConfigurationTask {
@@ -24,6 +25,14 @@
Class clazz =
ReflectHelper.classForName("org.hibernate.ejb.Ejb3Configuration",
JPAConfigurationTask.class);
Object ejb3cfg = clazz.newInstance();
+
+ if(entityResolver!=null) {
+ Class resolver = ReflectHelper.classForName(entityResolver, this.getClass());
+ Object object = resolver.newInstance();
+ Method method = clazz.getMethod("setEntityResolver", new Class[] {
EntityResolver.class });
+ method.invoke(ejb3cfg, new Object[] { object } );
+ }
+
Method method = clazz.getMethod("configure", new Class[] { String.class,
Map.class });
if ( method.invoke(ejb3cfg, new Object[] { persistenceUnit, overrides } ) == null ) {
throw new BuildException("Persistence unit not found: '" +
persistenceUnit + "'.");
@@ -63,10 +72,6 @@
complain("configurationfile");
}
- public void setEntityResolver(String entityResolverName) {
- complain("entityresolver");
- }
-
private void complain(String param) {
throw new BuildException("<" + getTaskName() + "> currently only
support autodiscovery from META-INF/persistence.xml. Thus setting the " + param +
" attribute is not allowed");
}
Show replies by date