Skip to content

Commit afc9cc1

Browse files
committed
HBX-2850: Add support for generation of 'orm.xml' files (as 'hbm.xml' will disappear at some point)
- Add a test to verify the working of the 'orm.xml' transformation Signed-off-by: Koen Aers <[email protected]>
1 parent 33da5d6 commit afc9cc1

File tree

5 files changed

+84
-1
lines changed

5 files changed

+84
-1
lines changed

test/maven/src/it/generateHbm/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>org.hibernate.tool.test</groupId>
8-
<artifactId>hbm2ddl</artifactId>
8+
<artifactId>generateHbm</artifactId>
99
<version>0.0.1-SNAPSHOT</version>
1010

1111
<properties>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
invoker.java.version = 1.8+
2+
invoker.goals = generate-resources
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.hibernate.tool.test</groupId>
6+
<artifactId>transformHbm</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
9+
10+
<properties>
11+
<h2.version>1.4.200</h2.version>
12+
<sql.version>1.5</sql.version>
13+
<hibernate.version>7.0.0-SNAPSHOT</hibernate.version>
14+
</properties>
15+
16+
<build>
17+
<plugins>
18+
<plugin>
19+
<groupId>org.hibernate.tool</groupId>
20+
<artifactId>hibernate-tools-maven</artifactId>
21+
<version>${hibernate.version}</version>
22+
<dependencies>
23+
<dependency>
24+
<groupId>org.hibernate.tool</groupId>
25+
<artifactId>hibernate-tools-orm</artifactId>
26+
<version>${hibernate.version}</version>
27+
</dependency>
28+
</dependencies>
29+
<executions>
30+
<execution>
31+
<id>transformHbm</id>
32+
<phase>generate-sources</phase>
33+
<goals>
34+
<goal>hbm2orm</goal>
35+
</goals>
36+
<configuration>
37+
<ejb3>true</ejb3>
38+
</configuration>
39+
</execution>
40+
</executions>
41+
</plugin>
42+
43+
</plugins>
44+
</build>
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!-- Generated 18 jul. 2024 12:32:47 by Hibernate Tools 6.6.0-SNAPSHOT --><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
3+
<hibernate-mapping>
4+
<class catalog="BARDB" name="Foo" optimistic-lock="none" schema="PUBLIC" table="FOO">
5+
<id name="id" type="int">
6+
<column name="ID"/>
7+
<generator class="assigned"/>
8+
</id>
9+
<property name="baz" type="string">
10+
<column length="256" name="BAZ"/>
11+
</property>
12+
</class>
13+
</hibernate-mapping>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import java.io.*;
2+
3+
File file = new File(basedir, "src/main/resources/Foo.mapping.xml");
4+
if (!file.isFile()) {
5+
throw new FileNotFoundException("Could not find generated HBM file: " + file);
6+
}

0 commit comments

Comments
 (0)