Index: hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2JavaMojoTest.java
===================================================================
--- hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2JavaMojoTest.java (revision 5913)
+++ hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2JavaMojoTest.java (working copy)
@@ -40,4 +40,13 @@
assertTrue( "can't find target/hibernate3/generated-sources-jpa/jpaconfiguration/Person.java",
checkExists( "target/hibernate3/generated-sources-jpa/jpaconfiguration/Person.java" ) );
}
+
+ public void testSpringMojoExecution()
+ throws Exception
+ {
+ deleteDirectory( "target/hibernate3/generated-sources-spring" );
+ getHibernateMojo( "hbm2java", "springconfiguration" ).execute();
+ assertTrue( "can't find target/hibernate3/generated-sources-spring/springconfiguration/SpringLocation.java",
+ checkExists( "target/hibernate3/generated-sources-spring/springconfiguration/SpringLocation.java" ) );
+ }
}
\ No newline at end of file
Index: hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2DDLMojoTest.java
===================================================================
--- hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2DDLMojoTest.java (revision 5913)
+++ hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2DDLMojoTest.java (working copy)
@@ -38,4 +38,13 @@
assertTrue( "can't find target/hibernate3/sql-jpa/schema.sql",
checkExists( "target/hibernate3/sql-jpa/schema.sql" ) );
}
+
+ public void testSpringMojoExecution()
+ throws Exception
+ {
+ deleteDirectory( "target/hibernate3/sql-spring" );
+ getHibernateMojo( "hbm2ddl", "springconfiguration" ).execute();
+ assertTrue( "can't find target/hibernate3/sql-spring/schema.sql",
+ checkExists( "target/hibernate3/sql-spring/schema.sql" ) );
+ }
}
Index: hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2DocMojoTest.java
===================================================================
--- hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2DocMojoTest.java (revision 5913)
+++ hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2DocMojoTest.java (working copy)
@@ -36,4 +36,13 @@
assertTrue( "can't find target/hibernate3/javadoc-jpa/entities/jpaconfiguration/Person.html",
checkExists( "target/hibernate3/javadoc-jpa/entities/jpaconfiguration/Person.html" ) );
}
+
+ public void testSpringMojoExecution()
+ throws Exception
+ {
+ deleteDirectory( "target/hibernate3/javadoc-spring" );
+ getHibernateMojo( "hbm2doc", "springconfiguration" ).execute();
+ assertTrue( "can't find target/hibernate3/javadoc-spring/entities/springconfiguration/SpringLocation.html",
+ checkExists( "target/hibernate3/javadoc-spring/entities/springconfiguration/SpringLocation.html" ) );
+ }
}
\ No newline at end of file
Index: hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2HbmXmlMojoTest.java
===================================================================
--- hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2HbmXmlMojoTest.java (revision 5913)
+++ hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2HbmXmlMojoTest.java (working copy)
@@ -40,4 +40,13 @@
assertTrue( "can't find target/hibernate3/generated-mappings-jpa/jpaconfiguration/Person.hbm.xml",
checkExists( "target/hibernate3/generated-mappings-jpa/jpaconfiguration/Person.hbm.xml" ) );
}
+
+ public void testSpringMojoExecution()
+ throws Exception
+ {
+ deleteDirectory( "target/hibernate3/generated-mappings-spring" );
+ getHibernateMojo( "hbm2hbmxml", "springconfiguration" ).execute();
+ assertTrue( "can't find target/hibernate3/generated-mappings-spring/springconfiguration/SpringLocation.hbm.xml",
+ checkExists( "target/hibernate3/generated-mappings-spring/springconfiguration/SpringLocation.hbm.xml" ) );
+ }
}
\ No newline at end of file
Index: hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2CfgXmlMojoTest.java
===================================================================
--- hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2CfgXmlMojoTest.java (revision 5913)
+++ hibernate3-maven-plugin/src/test/java/org/codehaus/mojo/hibernate3/plugin/Hbm2CfgXmlMojoTest.java (working copy)
@@ -38,4 +38,13 @@
assertTrue( "can't find target/hibernate3/generated-mappings-jpa/hibernate.cfg.xml",
checkExists( "target/hibernate3/generated-mappings-jpa/hibernate.cfg.xml" ) );
}
+
+ public void testSpringMojoExecution()
+ throws Exception
+ {
+ deleteDirectory( "target/hibernate3/generated-mappings-spring" );
+ getHibernateMojo( "hbm2cfgxml", "springconfiguration" ).execute();
+ assertTrue( "can't find target/hibernate3/generated-mappings-spring/hibernate.cfg.xml",
+ checkExists( "target/hibernate3/generated-mappings-spring/hibernate.cfg.xml" ) );
+ }
}
Index: hibernate3-maven-plugin/src/test/java/springconfiguration/SpringLocation.java
===================================================================
--- hibernate3-maven-plugin/src/test/java/springconfiguration/SpringLocation.java (revision 0)
+++ hibernate3-maven-plugin/src/test/java/springconfiguration/SpringLocation.java (revision 0)
@@ -0,0 +1,152 @@
+package springconfiguration;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+public class SpringLocation
+ implements Serializable
+{
+ private int streetNumber;
+
+ private String city;
+
+ private String streetName;
+
+ private String countryCode;
+
+ private Locale locale;
+
+ private String description;
+
+ public boolean equals( Object other )
+ {
+ SpringLocation l = (SpringLocation) other;
+ return l.getCity().equals( city ) && l.getStreetName().equals( streetName ) &&
+ l.getCountryCode().equals( countryCode ) && l.getStreetNumber() == streetNumber;
+ }
+
+ public int hashCode()
+ {
+ return streetName.hashCode();
+ }
+
+ /**
+ * Returns the city.
+ *
+ * @return String
+ */
+ public String getCity()
+ {
+ return city;
+ }
+
+ /**
+ * Sets the city.
+ *
+ * @param city The city to set
+ */
+ public void setCity( String city )
+ {
+ this.city = city;
+ }
+
+ /**
+ * Returns the countryCode.
+ *
+ * @return String
+ */
+ public String getCountryCode()
+ {
+ return countryCode;
+ }
+
+ /**
+ * Sets the countryCode.
+ *
+ * @param countryCode The countryCode to set
+ */
+ public void setCountryCode( String countryCode )
+ {
+ this.countryCode = countryCode;
+ }
+
+ /**
+ * Returns the description.
+ *
+ * @return String
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description The description to set
+ */
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+ /**
+ * Returns the locale.
+ *
+ * @return Locale
+ */
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ /**
+ * Sets the locale.
+ *
+ * @param locale The locale to set
+ */
+ public void setLocale( Locale locale )
+ {
+ this.locale = locale;
+ }
+
+ /**
+ * Returns the streetName.
+ *
+ * @return String
+ */
+ public String getStreetName()
+ {
+ return streetName;
+ }
+
+ /**
+ * Sets the streetName.
+ *
+ * @param streetName The streetName to set
+ */
+ public void setStreetName( String streetName )
+ {
+ this.streetName = streetName;
+ }
+
+ /**
+ * Returns the streetNumber.
+ *
+ * @return int
+ */
+ public int getStreetNumber()
+ {
+ return streetNumber;
+ }
+
+ /**
+ * Sets the streetNumber.
+ *
+ * @param streetNumber The streetNumber to set
+ */
+ public void setStreetNumber( int streetNumber )
+ {
+ this.streetNumber = streetNumber;
+ }
+}
\ No newline at end of file
Property changes on: hibernate3-maven-plugin/src/test/java/springconfiguration/SpringLocation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Index: hibernate3-maven-plugin/src/test/resources/springconfiguration/SpringLocation.hbm.xml
===================================================================
--- hibernate3-maven-plugin/src/test/resources/springconfiguration/SpringLocation.hbm.xml (revision 0)
+++ hibernate3-maven-plugin/src/test/resources/springconfiguration/SpringLocation.hbm.xml (revision 0)
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Property changes on: hibernate3-maven-plugin/src/test/resources/springconfiguration/SpringLocation.hbm.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Index: hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2doc-config.xml
===================================================================
--- hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2doc-config.xml (revision 0)
+++ hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2doc-config.xml (revision 0)
@@ -0,0 +1,22 @@
+
+
+
+
+ org.codehaus.mojo
+ hibernate3-maven-plugin
+
+
+
+ hbm2doc
+ target/hibernate3/javadoc-spring
+ springconfiguration
+
+
+
+ target/test-classes/springconfiguration/hibernate.cfg.xml
+
+
+
+
+
+
\ No newline at end of file
Property changes on: hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2doc-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Index: hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2hbmxml-config.xml
===================================================================
--- hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2hbmxml-config.xml (revision 0)
+++ hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2hbmxml-config.xml (revision 0)
@@ -0,0 +1,22 @@
+
+
+
+
+ org.codehaus.mojo
+ hibernate3-maven-plugin
+
+
+
+ hbm2hbmxml
+ target/hibernate3/generated-mappings-spring
+ springconfiguration
+
+
+
+ target/test-classes/springconfiguration/hibernate.cfg.xml
+
+
+
+
+
+
\ No newline at end of file
Property changes on: hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2hbmxml-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Index: hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2cfgxml-config.xml
===================================================================
--- hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2cfgxml-config.xml (revision 0)
+++ hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2cfgxml-config.xml (revision 0)
@@ -0,0 +1,22 @@
+
+
+
+
+ org.codehaus.mojo
+ hibernate3-maven-plugin
+
+
+
+ hbm2cfgxml
+ target/hibernate3/generated-mappings-spring
+ springconfiguration
+
+
+
+ target/test-classes/springconfiguration/hibernate.cfg.xml
+
+
+
+
+
+
\ No newline at end of file
Property changes on: hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2cfgxml-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Index: hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2java-config.xml
===================================================================
--- hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2java-config.xml (revision 0)
+++ hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2java-config.xml (revision 0)
@@ -0,0 +1,22 @@
+
+
+
+
+ org.codehaus.mojo
+ hibernate3-maven-plugin
+
+
+
+ hbm2java
+ target/hibernate3/generated-sources-spring
+ springconfiguration
+
+
+
+ target/test-classes/springconfiguration/hibernate.cfg.xml
+
+
+
+
+
+
\ No newline at end of file
Property changes on: hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2java-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Index: hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2ddl-config.xml
===================================================================
--- hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2ddl-config.xml (revision 0)
+++ hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2ddl-config.xml (revision 0)
@@ -0,0 +1,24 @@
+
+
+
+
+ org.codehaus.mojo
+ hibernate3-maven-plugin
+
+
+
+ hbm2ddl
+ target/hibernate3/sql-spring
+ springconfiguration
+
+
+
+ target/test-classes/springconfiguration/hibernate.cfg.xml
+ false
+ schema.sql
+
+
+
+
+
+
\ No newline at end of file
Property changes on: hibernate3-maven-plugin/src/test/resources/springconfiguration/hbm2ddl-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Index: hibernate3-maven-plugin/src/test/resources/springconfiguration/hibernate.cfg.xml
===================================================================
--- hibernate3-maven-plugin/src/test/resources/springconfiguration/hibernate.cfg.xml (revision 0)
+++ hibernate3-maven-plugin/src/test/resources/springconfiguration/hibernate.cfg.xml (revision 0)
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ springconfiguration/SpringLocation.hbm.xml
+
+
+
+ hibernate.dialect=org.hibernate.dialect.HSQLDialect
+
+
+
+
\ No newline at end of file
Property changes on: hibernate3-maven-plugin/src/test/resources/springconfiguration/hibernate.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Index: hibernate3-maven-plugin/src/site/apt/components.apt
===================================================================
--- hibernate3-maven-plugin/src/site/apt/components.apt (revision 5913)
+++ hibernate3-maven-plugin/src/site/apt/components.apt (working copy)
@@ -17,12 +17,14 @@
*-------------+--------------------------------------+---------------------------------+
| hbm2ddl | target/hibernate3/sql | configuration (jdk14)
| | | annotationconfiguration (jdk15)
+| | | springconfiguration
*-------------+--------------------------------------+---------------------------------+
| hbm2doc | target/hibernate3/javadoc | configuration (jdk14)
-| | | annotationconfiguration (jdk15)
+| | | configuration (jdk15)
*-------------+--------------------------------------+---------------------------------+
| hbm2hbmxml | target/hibernate3/generated-mappings | jdbcconfiguration
*-------------+--------------------------------------+---------------------------------+
| hbm2java | target/hibernate3/generated-sources | configuration (jdk14)
| | | annotationconfiguration (jdk15)
+| | | springconfiguration
*-------------+--------------------------------------+---------------------------------+
Index: maven-hibernate3-components/maven-hibernate3-jdk14/src/main/java/org/codehaus/mojo/hibernate3/configuration/SpringComponentConfiguration.java
===================================================================
--- maven-hibernate3-components/maven-hibernate3-jdk14/src/main/java/org/codehaus/mojo/hibernate3/configuration/SpringComponentConfiguration.java (revision 0)
+++ maven-hibernate3-components/maven-hibernate3-jdk14/src/main/java/org/codehaus/mojo/hibernate3/configuration/SpringComponentConfiguration.java (revision 0)
@@ -0,0 +1,54 @@
+package org.codehaus.mojo.hibernate3.configuration;
+
+import java.net.URL;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.codehaus.mojo.hibernate3.ExporterMojo;
+import org.hibernate.cfg.Configuration;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+import org.springframework.orm.hibernate3.LocalSessionFactoryBean;
+
+public class SpringComponentConfiguration
+ extends AbstractComponentConfiguration
+{
+ // --------------------- Interface ComponentConfiguration ---------------------
+ public String getName()
+ {
+ return "springconfiguration";
+ }
+
+ public Configuration getConfiguration(final ExporterMojo exporterMojo)
+ throws MojoExecutionException
+ {
+ setExporterMojo(exporterMojo);
+
+ final URL configUrl = getConfigurationFile();
+
+ final Configuration configuration;
+ if (configUrl == null)
+ {
+ configuration = new Configuration();
+ }
+ else
+ {
+ final String sessionFactoryBeanName =
+ exporterMojo.getComponentProperty("sessionFactory", "sessionFactory");
+
+ final BeanFactory beanFactory =
+ new FileSystemXmlApplicationContext(configUrl.getPath());
+ // TODO: Look up by type if name lookup fails
+ final LocalSessionFactoryBean sessionFactoryBean =
+ (LocalSessionFactoryBean) beanFactory.getBean("&" + sessionFactoryBeanName);
+ configuration = sessionFactoryBean.getConfiguration();
+ }
+
+ return configuration;
+ }
+
+ protected Configuration createConfiguration()
+ {
+ // Not called
+ return null;
+ }
+}
Property changes on: maven-hibernate3-components/maven-hibernate3-jdk14/src/main/java/org/codehaus/mojo/hibernate3/configuration/SpringComponentConfiguration.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Index: maven-hibernate3-components/maven-hibernate3-jdk14/src/main/resources/META-INF/plexus/components.xml
===================================================================
--- maven-hibernate3-components/maven-hibernate3-jdk14/src/main/resources/META-INF/plexus/components.xml (revision 5913)
+++ maven-hibernate3-components/maven-hibernate3-jdk14/src/main/resources/META-INF/plexus/components.xml (working copy)
@@ -13,5 +13,11 @@
org.codehaus.mojo.hibernate3.configuration.JDBCComponentConfiguration
+
+ org.codehaus.mojo.hibernate3.configuration.ComponentConfiguration
+ springconfiguration
+ org.codehaus.mojo.hibernate3.configuration.SpringComponentConfiguration
+
+
Index: maven-hibernate3-components/maven-hibernate3-jdk14/pom.xml
===================================================================
--- maven-hibernate3-components/maven-hibernate3-jdk14/pom.xml (revision 5913)
+++ maven-hibernate3-components/maven-hibernate3-jdk14/pom.xml (working copy)
@@ -7,4 +7,13 @@
maven-hibernate3-jdk14
Maven Hibernate3 Implementation - JDK14
+
+
+
+ org.springframework
+ spring-hibernate3
+ 2.0.7
+
+
+