hibernate 3-maven-plugin構成

1489 ワード

hibernate 3-maven-pluginを使用すると、hibernateまたはJPAの構成に基づいてテーブル・スクリプトをエクスポートし、javaクラスをテーブル構造に基づいてエクスポートします.次に、JPAの構成情報に基づいてテーブル・スクリプトをエクスポートする例を示します.
 
 
<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>hibernate3-maven-plugin</artifactId>
				<version>2.2</version>
				<executions>
					<execution>
						<goals>
							<goal>hbm2ddl</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<components>
						<component>
							<name>hbm2ddl</name>
							<implementation>jpaconfiguration</implementation>
							<outputDirectory>src/main/db</outputDirectory>
						</component>
					</components>
					<componentProperties>
						<persistenceunit>PersistenceUnit</persistenceunit>
						<outputfilename>schema.ddl</outputfilename>
						<drop>false</drop>
						<create>true</create>
						<export>false</export>
						<format>true</format>
					</componentProperties>
				</configuration>
			</plugin>
 
persistenceunitはpersistence.xmlファイルの永続ユニット名と一致します.
 
実行時にmvn:hibernate 3:hbm 2 ddlを使用