├── maven ├── docs │ └── examples │ │ ├── hbm2orm │ │ ├── .gitignore │ │ ├── simple-default │ │ │ ├── README.md │ │ │ ├── src │ │ │ │ └── main │ │ │ │ │ └── resources │ │ │ │ │ └── simple.hbm.xml │ │ │ └── pom.xml │ │ └── with-user-type │ │ │ ├── README.md │ │ │ ├── src │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── user-type.hbm.xml │ │ │ └── pom.xml │ │ ├── hbm2java │ │ ├── template-path │ │ │ ├── templates │ │ │ │ └── pojo │ │ │ │ │ └── Pojo.ftl │ │ │ └── README.md │ │ ├── jpa-default │ │ │ └── README.md │ │ ├── no-generics │ │ │ └── README.md │ │ ├── use-generics │ │ │ └── README.md │ │ ├── no-annotations │ │ │ └── README.md │ │ └── output-directory │ │ │ └── README.md │ │ └── 5-minute-tutorial │ │ └── README.md └── src │ └── functionalTest │ └── resources │ └── org │ └── hibernate │ └── tool │ └── maven │ └── simple.hbm.xml ├── gradle ├── plugin │ ├── bin │ │ └── .gitignore │ └── src │ │ └── functionalTest │ │ └── java │ │ └── org │ │ └── hibernate │ │ └── tool │ │ └── gradle │ │ └── TutorialTest.java ├── resources │ ├── gradle-wrapper.jar │ ├── libs.versions.toml │ └── gradle-wrapper.properties ├── docs │ └── examples │ │ └── 5-minute-tutorial │ │ ├── gradle │ │ ├── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ └── libs.versions.toml │ │ ├── .gitignore │ │ ├── gradle.properties │ │ ├── .gitattributes │ │ ├── app │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── org │ │ │ │ └── example │ │ │ │ └── App.java │ │ │ └── test │ │ │ └── java │ │ │ └── org │ │ │ └── example │ │ │ └── AppTest.java │ │ └── settings.gradle ├── .gitignore ├── .gitattributes ├── settings.gradle └── README.md ├── .github ├── hibernate-github-bot.yml ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ └── build_test.yml ├── .release └── .gitignore ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── ant ├── docs │ └── examples │ │ ├── native │ │ ├── Foo.java │ │ ├── Foo.hbm.xml │ │ ├── README.md │ │ └── hibernate.cfg.xml │ │ ├── jpa │ │ ├── Foo.java │ │ ├── README.md │ │ └── META-INF │ │ │ └── persistence.xml │ │ ├── cfgxml │ │ └── hibernate.cfg.xml │ │ ├── templatepath │ │ ├── templates │ │ │ └── pojo │ │ │ │ └── Pojo.ftl │ │ └── README.md │ │ ├── classpath │ │ ├── README.md │ │ └── additional │ │ │ └── src │ │ │ └── HelloExporter.java │ │ ├── properties │ │ └── README.md │ │ ├── configuration │ │ ├── default │ │ │ └── README.md │ │ └── fileset │ │ │ └── simple.hbm.xml │ │ └── 5-minute-tutorial │ │ └── README.md ├── src │ ├── main │ │ └── java │ │ │ └── org │ │ │ └── hibernate │ │ │ └── tool │ │ │ └── ant │ │ │ └── fresh │ │ │ └── ExportDdlTask.java │ ├── it │ │ └── java │ │ │ └── org │ │ │ └── hibernate │ │ │ └── tool │ │ │ └── ant │ │ │ └── TutorialTestIT.java │ └── test │ │ └── java │ │ └── org │ │ └── hibernate │ │ └── tool │ │ └── ant │ │ └── test │ │ └── util │ │ └── ProjectUtil.java └── README.md ├── orm ├── src │ ├── main │ │ ├── resources │ │ │ ├── doc │ │ │ │ ├── inherit.gif │ │ │ │ ├── hibernate_logo.gif │ │ │ │ └── index.html │ │ │ ├── lint │ │ │ │ └── text-report.ftl │ │ │ ├── pojo │ │ │ │ ├── GetPropertyAnnotation.ftl │ │ │ │ ├── PojoExtraClassCode.ftl │ │ │ │ ├── test.ftl │ │ │ │ ├── PojoTypeDeclaration.ftl │ │ │ │ ├── PojoFields.ftl │ │ │ │ ├── PojoToString.ftl │ │ │ │ ├── PojoInterfacePropertyAccessors.ftl │ │ │ │ ├── Ejb3TypeDeclaration.ftl │ │ │ │ └── Pojo.ftl │ │ │ ├── hbm │ │ │ │ ├── pkcolumn.hbm.ftl │ │ │ │ ├── element-element.hbm.ftl │ │ │ │ ├── import.hbm.ftl │ │ │ │ ├── key.hbm.ftl │ │ │ │ ├── one-to-many-element.hbm.ftl │ │ │ │ ├── properties.hbm.ftl │ │ │ │ ├── meta.hbm.ftl │ │ │ │ ├── column.hbm.ftl │ │ │ │ ├── timestamp.hbm.ftl │ │ │ │ ├── version.hbm.ftl │ │ │ │ ├── filter-def.hbm.ftl │ │ │ │ ├── many-to-many-element.hbm.ftl │ │ │ │ ├── dynamic-component.hbm.ftl │ │ │ │ ├── component.hbm.ftl │ │ │ │ ├── many-to-any-element.hbm.ftl │ │ │ │ ├── composite-element.hbm.ftl │ │ │ │ ├── nested-composite-element.hbm.ftl │ │ │ │ └── collection-tableattr.hbm.ftl │ │ │ └── debug.ftl │ │ └── java │ │ │ └── org │ │ │ └── hibernate │ │ │ └── tool │ │ │ ├── internal │ │ │ ├── util │ │ │ │ ├── DummyDialect.java │ │ │ │ └── TableNameQualifier.java │ │ │ ├── export │ │ │ │ ├── lint │ │ │ │ │ ├── IssueCollector.java │ │ │ │ │ └── Detector.java │ │ │ │ └── java │ │ │ │ │ └── NoopImportContext.java │ │ │ └── reveng │ │ │ │ ├── strategy │ │ │ │ └── DefaultStrategy.java │ │ │ │ ├── binder │ │ │ │ └── PrimaryKeyInfo.java │ │ │ │ └── util │ │ │ │ └── EnhancedValue.java │ │ │ ├── api │ │ │ ├── xml │ │ │ │ └── XMLPrettyPrinterStrategy.java │ │ │ ├── reveng │ │ │ │ └── AssociationInfo.java │ │ │ ├── metadata │ │ │ │ ├── MetadataConstants.java │ │ │ │ └── MetadataDescriptor.java │ │ │ ├── export │ │ │ │ ├── Exporter.java │ │ │ │ └── ArtifactCollector.java │ │ │ └── version │ │ │ │ └── Version.java │ │ │ └── ide │ │ │ └── completion │ │ │ ├── SimpleHQLLexer.java │ │ │ └── IHQLCompletionRequestor.java │ └── test │ │ └── java │ │ └── org │ │ └── hibernate │ │ └── tool │ │ ├── internal │ │ ├── util │ │ │ └── DummyDialectTest.java │ │ └── reveng │ │ │ └── binder │ │ │ └── TypeUtilsTest.java │ │ └── api │ │ └── export │ │ └── ExporterTypeTest.java └── README.md ├── language └── src │ └── test │ └── resources │ ├── hibernate.properties │ └── log4j2.properties ├── test ├── nodb │ ├── src │ │ └── test │ │ │ ├── resources │ │ │ └── org │ │ │ │ └── hibernate │ │ │ │ └── tool │ │ │ │ ├── hbm2x │ │ │ │ ├── GenericExporterTest │ │ │ │ │ ├── freeinc.ftl │ │ │ │ │ ├── generic-content.ftl │ │ │ │ │ ├── generic-test.ftl │ │ │ │ │ ├── generic-exception.ftl │ │ │ │ │ └── freemarker.ftl │ │ │ │ ├── Hbm2JavaTest │ │ │ │ │ └── HelloWorld.java_ │ │ │ │ └── PropertiesTest │ │ │ │ │ └── PropertiesUsage.java_ │ │ │ │ ├── ant │ │ │ │ ├── JavaFormatter │ │ │ │ │ └── formatting │ │ │ │ │ │ ├── SimpleOne.java │ │ │ │ │ │ └── Simple5One.java │ │ │ │ ├── Exception │ │ │ │ │ └── TopDown.hbm.xml │ │ │ │ └── NoConnInfoExport │ │ │ │ │ └── TopDown.hbm.xml │ │ │ │ └── ide │ │ │ │ └── completion │ │ │ │ └── ModelCompletion │ │ │ │ ├── resources │ │ │ │ ├── StoreCity.java │ │ │ │ └── StoreCity.hbm.xml │ │ │ └── java │ │ │ └── org │ │ │ └── hibernate │ │ │ └── tool │ │ │ └── hbm2x │ │ │ └── hbm2hbmxml │ │ │ ├── OneToOneTest │ │ │ ├── Address.java │ │ │ └── Person.java │ │ │ └── IdBagTest │ │ │ └── Group.java │ └── README.md ├── common │ └── src │ │ └── main │ │ ├── resources │ │ └── org │ │ │ └── hibernate │ │ │ └── tool │ │ │ ├── ant │ │ │ ├── JDBCConfiguration │ │ │ │ └── Pojo.ftl │ │ │ ├── Properties │ │ │ │ ├── Pojo.ftl │ │ │ │ └── SomeClass.hbm.xml │ │ │ ├── JPAPUnit │ │ │ │ └── hibernate.cfg.xml │ │ │ ├── JPABogusPUnit │ │ │ │ └── hibernate.cfg.xml │ │ │ ├── EJB3Configuration │ │ │ │ └── hibernate.cfg.xml │ │ │ ├── JPAPropertyOverridesPUnit │ │ │ │ └── hibernate.cfg.xml │ │ │ ├── Query │ │ │ │ └── hibernate.cfg.xml │ │ │ ├── Hbm2JavaConfiguration │ │ │ │ └── SomeClass.hbm.xml │ │ │ ├── Hbm2JavaEJB3Configuration │ │ │ │ └── SomeClass.hbm.xml │ │ │ ├── Cfg2HbmNoError │ │ │ │ └── build.xml │ │ │ ├── GenericExport │ │ │ │ └── TopDown.hbm.xml │ │ │ ├── AntHibernateTool │ │ │ │ └── TopDown.hbm.xml │ │ │ ├── SchemaExportWarning │ │ │ │ └── TopDown.hbm.xml │ │ │ ├── SchemaUpdateWarning │ │ │ │ ├── TopDown.hbm.xml │ │ │ │ └── build.xml │ │ │ ├── HbmLint │ │ │ │ └── hibernate.cfg.xml │ │ │ └── JDBCConfigWithRevEngXml │ │ │ │ └── hibernate.reveng.xml │ │ │ └── jdbc2cfg │ │ │ └── RevEngForeignKey │ │ │ └── badforeignkeytest.reveng.xml │ │ └── java │ │ └── org │ │ └── hibernate │ │ └── tool │ │ ├── hbmlint │ │ └── HbmLintTest │ │ │ ├── BrokenLazy.java │ │ │ └── BrokenNonLazy.java │ │ └── ant │ │ ├── Query │ │ ├── ObjectResult.java │ │ └── SerializableResult.java │ │ ├── Cfg2HbmWithCustomReverseNamingStrategy │ │ └── Strategy.java │ │ └── Cfg2HbmWithPackageNameAndReverseNamingStrategy │ │ └── Strategy.java ├── README.md ├── utils │ ├── README.md │ └── src │ │ └── test │ │ └── resources │ │ └── org │ │ └── hibernate │ │ └── tools │ │ └── test │ │ └── util │ │ └── HelloWorld.hbm.xml ├── maven │ └── src │ │ └── it │ │ ├── hbm2dao │ │ ├── postbuild.bsh │ │ └── prebuild.bsh │ │ ├── generateHbm │ │ ├── postbuild.bsh │ │ ├── prebuild.bsh │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── templates │ │ │ └── pojo │ │ │ └── PojoFields.ftl │ │ ├── hbm2java │ │ ├── postbuild.bsh │ │ ├── prebuild.bsh │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── templates │ │ │ └── pojo │ │ │ └── PojoFields.ftl │ │ ├── transformHbm │ │ └── postbuild.bsh │ │ └── hbm2ddl │ │ ├── postbuild.bsh │ │ └── prebuild.bsh ├── h2 │ └── src │ │ └── test │ │ ├── java │ │ └── org │ │ │ └── hibernate │ │ │ └── tool │ │ │ └── test │ │ │ └── db │ │ │ └── h2 │ │ │ └── TestSuite.java │ │ └── resources │ │ └── org │ │ └── hibernate │ │ └── tool │ │ └── entitynaming │ │ └── reveng.xml ├── hsql │ └── src │ │ └── test │ │ └── java │ │ └── org │ │ └── hibernate │ │ └── tool │ │ └── test │ │ └── db │ │ └── hsql │ │ └── TestSuite.java ├── mysql │ └── src │ │ └── test │ │ └── java │ │ └── org │ │ └── hibernate │ │ └── tool │ │ └── test │ │ └── db │ │ └── mysql │ │ └── TestSuite.java └── mssql │ └── src │ └── test │ └── java │ └── org │ └── hibernate │ └── tool │ └── test │ └── db │ └── sqlserver │ └── TestSuite.java ├── jbt └── src │ └── main │ └── java │ └── org │ └── hibernate │ └── tool │ ├── hbm2x │ ├── DocExporter.java │ ├── QueryExporter.java │ ├── GenericExporter.java │ ├── DAOExporter.java │ ├── Hbm2DDLExporter.java │ ├── POJOExporter.java │ ├── HibernateConfigurationExporter.java │ └── HibernateMappingExporter.java │ └── orm │ └── jbt │ ├── api │ └── wrp │ │ ├── Wrapper.java │ │ ├── CollectionMetadataWrapper.java │ │ ├── RevengStrategyWrapper.java │ │ ├── HqlCodeAssistWrapper.java │ │ ├── JoinWrapper.java │ │ ├── Cfg2HbmToolWrapper.java │ │ ├── CriteriaWrapper.java │ │ ├── SchemaExportWrapper.java │ │ ├── DdlExporterWrapper.java │ │ ├── QueryExporterWrapper.java │ │ ├── DatabaseReaderWrapper.java │ │ ├── ArtifactCollectorWrapper.java │ │ ├── OverrideRepositoryWrapper.java │ │ ├── GenericExporterWrapper.java │ │ ├── SessionWrapper.java │ │ ├── RevengSettingsWrapper.java │ │ ├── TableFilterWrapper.java │ │ ├── HbmExporterWrapper.java │ │ ├── ForeignKeyWrapper.java │ │ ├── PrimaryKeyWrapper.java │ │ └── QueryWrapper.java │ └── internal │ ├── util │ └── MockDialect.java │ └── wrp │ └── AbstractWrapper.java └── utils ├── src ├── main │ └── java │ │ └── org │ │ └── hibernate │ │ └── tool │ │ └── util │ │ ├── StringUtil.java │ │ └── ReflectionUtil.java └── test │ └── java │ └── org │ └── hibernate │ └── tool │ └── util │ └── StringUtilTest.java └── README.md /maven/docs/examples/hbm2orm/.gitignore: -------------------------------------------------------------------------------- 1 | *.mapping.xml -------------------------------------------------------------------------------- /gradle/plugin/bin/.gitignore: -------------------------------------------------------------------------------- 1 | /functionalTest/ 2 | /main/ 3 | /test/ 4 | -------------------------------------------------------------------------------- /.github/hibernate-github-bot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | jira: 3 | projectKey: "HBX" 4 | -------------------------------------------------------------------------------- /.release/.gitignore: -------------------------------------------------------------------------------- 1 | # The folder into which we checkout our release scripts into 2 | * 3 | !.gitignore -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | .classpath 3 | .project 4 | .settings 5 | .DS_Store 6 | .idea 7 | *.iml 8 | .java-version 9 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hibernate/hibernate-tools/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /ant/docs/examples/native/Foo.java: -------------------------------------------------------------------------------- 1 | public class Foo { 2 | 3 | public int id; 4 | public String bar; 5 | 6 | } 7 | -------------------------------------------------------------------------------- /gradle/resources/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hibernate/hibernate-tools/HEAD/gradle/resources/gradle-wrapper.jar -------------------------------------------------------------------------------- /orm/src/main/resources/doc/inherit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hibernate/hibernate-tools/HEAD/orm/src/main/resources/doc/inherit.gif -------------------------------------------------------------------------------- /orm/src/main/resources/doc/hibernate_logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hibernate/hibernate-tools/HEAD/orm/src/main/resources/doc/hibernate_logo.gif -------------------------------------------------------------------------------- /ant/docs/examples/native/Foo.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /gradle/docs/examples/5-minute-tutorial/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hibernate/hibernate-tools/HEAD/gradle/docs/examples/5-minute-tutorial/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/resources/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | junit-jupiter = "${junit-jupiter.version}" 3 | 4 | [libraries] 5 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" } 6 | -------------------------------------------------------------------------------- /gradle/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | # Ignore the Gradle folder as this is constructed on the fly 8 | gradle 9 | -------------------------------------------------------------------------------- /gradle/docs/examples/5-minute-tutorial/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | # Ignore the output generated by the Hibernate Tools plugin 8 | generated-sources -------------------------------------------------------------------------------- /gradle/docs/examples/5-minute-tutorial/gradle.properties: -------------------------------------------------------------------------------- 1 | # This file was generated by the Gradle 'init' task. 2 | # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties 3 | 4 | #org.gradle.configuration-cache=true 5 | 6 | -------------------------------------------------------------------------------- /gradle/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # Linux start script should use lf 5 | /gradlew text eol=lf 6 | 7 | # These are Windows script files and should use crlf 8 | *.bat text eol=crlf 9 | 10 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Please delete this text, and add a link to the Jira issue solved by this PR; 2 | see https://hibernate.atlassian.net/browse/HBX. 3 | 4 | Remember to prepend the title of this PR, as well as all commit messages, 5 | with the key of the Jira issue (`HBX-`). 6 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | wrapperVersion=3.3.4 2 | distributionType=bin 3 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip 4 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.4/maven-wrapper-3.3.4.jar 5 | -------------------------------------------------------------------------------- /gradle/resources/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-${gradle.version}-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradle/docs/examples/5-minute-tutorial/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradle/docs/examples/5-minute-tutorial/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # Linux start script should use lf 5 | /gradlew text eol=lf 6 | 7 | # These are Windows script files and should use crlf 8 | *.bat text eol=crlf 9 | 10 | # Binary files should be left untouched 11 | *.jar binary 12 | 13 | -------------------------------------------------------------------------------- /orm/src/test/java/org/hibernate/tool/internal/util/DummyDialectTest.java: -------------------------------------------------------------------------------- 1 | package org.hibernate.tool.internal.util; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertNotNull; 6 | 7 | public class DummyDialectTest { 8 | 9 | @Test 10 | public void testDummyDialect() { 11 | assertNotNull(DummyDialect.INSTANCE); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /gradle/docs/examples/5-minute-tutorial/app/src/main/java/org/example/App.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file was generated by the Gradle 'init' task 3 | */ 4 | package org.example; 5 | 6 | public class App { 7 | public String getGreeting() { 8 | return "Hello World!"; 9 | } 10 | 11 | public static void main(String[] args) { 12 | System.out.println(new App().getGreeting()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ant/docs/examples/jpa/Foo.java: -------------------------------------------------------------------------------- 1 | import jakarta.persistence.Entity; 2 | import jakarta.persistence.Id; 3 | 4 | @Entity 5 | public class Foo { 6 | 7 | @Id 8 | private int id; 9 | private String bar; 10 | 11 | public int getId() { return id; } 12 | public void setId(int id) { this.id = id; } 13 | 14 | public String getBar() { return bar;} 15 | public void setBar(String bar) { this.bar = bar; } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /language/src/test/resources/hibernate.properties: -------------------------------------------------------------------------------- 1 | hibernate.dialect org.hibernate.dialect.H2Dialect 2 | hibernate.connection.driver_class org.h2.Driver 3 | #hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE 4 | hibernate.connection.url jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1 5 | hibernate.connection.username sa 6 | hibernate.connection.password 7 | 8 | hibernate.show_sql true 9 | hibernate.format_sql true 10 | hibernate.highlight_sql true 11 | -------------------------------------------------------------------------------- /gradle/docs/examples/5-minute-tutorial/gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | # This file was generated by the Gradle 'init' task. 2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format 3 | 4 | [versions] 5 | guava = "33.3.1-jre" 6 | junit-jupiter = "5.11.3" 7 | 8 | [libraries] 9 | guava = { module = "com.google.guava:guava", version.ref = "guava" } 10 | junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" } 11 | -------------------------------------------------------------------------------- /gradle/docs/examples/5-minute-tutorial/app/src/test/java/org/example/AppTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This source file was generated by the Gradle 'init' task 3 | */ 4 | package org.example; 5 | 6 | import org.junit.jupiter.api.Test; 7 | import static org.junit.jupiter.api.Assertions.*; 8 | 9 | class AppTest { 10 | @Test void appHasAGreeting() { 11 | App classUnderTest = new App(); 12 | assertNotNull(classUnderTest.getGreeting(), "app should have a greeting"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /gradle/docs/examples/5-minute-tutorial/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.13/userguide/multi_project_builds.html in the Gradle documentation. 6 | */ 7 | 8 | plugins { 9 | // Apply the foojay-resolver plugin to allow automatic download of JDKs 10 | id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0' 11 | } 12 | 13 | rootProject.name = '5-minute-tutorial' 14 | include('app') 15 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "monthly" 12 | groups: 13 | workflow-actions: 14 | patterns: 15 | - "*" 16 | allow: 17 | - dependency-name: "actions/*" 18 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/internal/util/DummyDialect.java: -------------------------------------------------------------------------------- 1 | package org.hibernate.tool.internal.util; 2 | 3 | import org.hibernate.dialect.DatabaseVersion; 4 | import org.hibernate.dialect.Dialect; 5 | 6 | public class DummyDialect extends Dialect { 7 | static final DummyDialect INSTANCE = new DummyDialect(); 8 | public DummyDialect() { 9 | super(new DatabaseVersion() { 10 | @Override 11 | public int getDatabaseMajorVersion() { 12 | return 0; 13 | } 14 | @Override 15 | public int getDatabaseMinorVersion() { 16 | return 0; 17 | } 18 | }); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /language/src/test/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | # Set to debug or trace if log4j initialization is failing 2 | status = warn 3 | 4 | # Console appender configuration 5 | appender.console.type = Console 6 | appender.console.name = consoleLogger 7 | appender.console.layout.type = PatternLayout 8 | appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n 9 | 10 | # Root logger level 11 | rootLogger.level = info 12 | 13 | # Root logger referring to console appender 14 | rootLogger.appenderRef.stdout.ref = consoleLogger 15 | 16 | logger.jdbc-bind.name=org.hibernate.orm.jdbc.bind 17 | logger.jdbc-bind.level=trace 18 | 19 | logger.jdbc-extract.name=org.hibernate.orm.jdbc.extract 20 | logger.jdbc-extract.level=trace 21 | -------------------------------------------------------------------------------- /orm/src/main/resources/lint/text-report.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#list lintissues as issue> 17 | ${issue} 18 | -------------------------------------------------------------------------------- /orm/src/main/resources/pojo/GetPropertyAnnotation.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#include "Ejb3PropertyGetAnnotation.ftl"/> 17 | -------------------------------------------------------------------------------- /.github/workflows/build_test.yml: -------------------------------------------------------------------------------- 1 | name: Build and Test 2 | 3 | on: 4 | pull_request 5 | 6 | jobs: 7 | test: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - name: Checkout PR Branch 12 | uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 13 | with: 14 | ref: ${{ github.event.pull_request.head.sha }} 15 | fetch-depth: 0 16 | 17 | - name: Setup Java 17 18 | uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 19 | with: 20 | java-version: 17 21 | distribution: temurin 22 | 23 | - name: Build and Test 24 | uses: GabrielBB/xvfb-action@b706e4e27b14669b486812790492dc50ca16b465 # v1.7 25 | with: 26 | run: ./mvnw clean install 27 | -------------------------------------------------------------------------------- /ant/docs/examples/cfgxml/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | org.h2.Driver 6 | jdbc:h2:tcp://localhost/./sakila 7 | sa 8 | SAKILA 9 | PUBLIC 10 | 11 | 12 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/pkcolumn.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/hbm2x/GenericExporterTest/freeinc.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2004 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | ${cl} 17 | 18 | -------------------------------------------------------------------------------- /ant/docs/examples/templatepath/templates/pojo/Pojo.ftl: -------------------------------------------------------------------------------- 1 | 16 | // This is just an example of a custom template 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/JDBCConfiguration/Pojo.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2004 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | /** Made by a template in your neighborhood */ -------------------------------------------------------------------------------- /maven/docs/examples/hbm2java/template-path/templates/pojo/Pojo.ftl: -------------------------------------------------------------------------------- 1 | 16 | // This is just an example of a custom template 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/hbm2x/GenericExporterTest/generic-content.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2004 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | File for ${item} in ${version} 17 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/element-element.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | <#list elementValue.columns as column> 18 | <#include "column.hbm.ftl"> 19 | 20 | 21 | -------------------------------------------------------------------------------- /gradle/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | rootProject.name = 'hibernate-tools-gradle' 19 | include('plugin') 20 | project( ':plugin' ).name = 'hibernate-tools-gradle' 21 | -------------------------------------------------------------------------------- /ant/src/main/java/org/hibernate/tool/ant/fresh/ExportDdlTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.ant.fresh; 19 | 20 | public class ExportDdlTask { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/import.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#list md.imports.keySet() as importKey> 17 | <#assign importDef = md.imports.get(importKey)> 18 | <#if !importKey.equals(importDef)> 19 | 20 | -------------------------------------------------------------------------------- /orm/src/main/resources/pojo/PojoExtraClassCode.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#if pojo.hasMetaAttribute("class-code")> // The following is extra code specified in the hbm.xml files 17 | ${pojo.getExtraClassCode()} 18 | // end of extra code specified in the hbm.xml files 19 | -------------------------------------------------------------------------------- /orm/src/test/java/org/hibernate/tool/internal/reveng/binder/TypeUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2019-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.internal.reveng.binder; 19 | 20 | public class TypeUtilsTest { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/ant/JavaFormatter/formatting/SimpleOne.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package formatting; 19 | 20 | public 21 | class 22 | SimpleOne { 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/hbm2x/DocExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbm2x; 19 | 20 | public class DocExporter extends org.hibernate.tool.internal.export.doc.DocExporter {} 21 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/hbm2x/QueryExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbm2x; 19 | 20 | public class QueryExporter extends org.hibernate.tool.internal.export.query.QueryExporter {} 21 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/hbm2x/GenericExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbm2x; 19 | 20 | public class GenericExporter extends org.hibernate.tool.internal.export.common.GenericExporter {} 21 | -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | [![Hibernate](https://static.jboss.org/hibernate/images/hibernate_200x150.png)](https://tools.hibernate.org) 18 | 19 | # Hibernate Tools Tests 20 | 21 | This is the parent project for the integration tests of the ORM, Maven and Ant modules. -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/ide/completion/ModelCompletion/resources: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | This file serves as a lookup beacon to find the proper resources folder in org.hibernate.tool.ide.completion.ModelCompletionTest -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/hbm2x/DAOExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbm2x; 19 | 20 | import org.hibernate.tool.internal.export.dao.DaoExporter; 21 | 22 | public class DAOExporter extends DaoExporter {} 23 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/Wrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | public interface Wrapper { 21 | 22 | default Object getWrappedObject() { return this; } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/key.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 18 | property-ref="${property.value.referencedPropertyName}" 19 | > 20 | <#list keyValue.columns as column> 21 | <#include "column.hbm.ftl"> 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/utils/README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | [![Hibernate](https://static.jboss.org/hibernate/images/hibernate_200x150.png)](https://tools.hibernate.org) 18 | 19 | # Hibernate Tools Test Utilities 20 | 21 | This module contains a number of utilities that are used in the different test modules. -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/hbm2x/Hbm2DDLExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbm2x; 19 | 20 | import org.hibernate.tool.internal.export.ddl.DdlExporter; 21 | 22 | public class Hbm2DDLExporter extends DdlExporter {} 23 | -------------------------------------------------------------------------------- /test/nodb/README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | [![Hibernate](https://static.jboss.org/hibernate/images/hibernate_200x150.png)](https://tools.hibernate.org) 18 | 19 | # Hibernate Tools Tests No Database 20 | 21 | This module contains a number of integration tests which don't need access to a database. -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/api/xml/XMLPrettyPrinterStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2017-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.api.xml; 19 | 20 | public interface XMLPrettyPrinterStrategy { 21 | 22 | String prettyPrint(String xml) throws Exception; 23 | } 24 | -------------------------------------------------------------------------------- /test/maven/src/it/hbm2dao/postbuild.bsh: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | File dao = new File(basedir, "target/generated-sources/PersonHome.java"); 19 | if (!dao.isFile()) { 20 | throw new FileNotFoundException("Could not find generated JPA DAO: " + dao); 21 | } 22 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/hbm2x/POJOExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2023-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbm2x; 19 | 20 | import org.hibernate.tool.internal.export.java.JavaExporter; 21 | 22 | public class POJOExporter extends JavaExporter { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/internal/export/lint/IssueCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.internal.export.lint; 19 | 20 | public interface IssueCollector { 21 | 22 | public abstract void reportIssue(Issue analyze); 23 | 24 | } -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/one-to-many-element.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 18 | entity-name="${elementValue.getReferencedEntityName()}" 19 | /> 20 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/properties.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | 19 | <#assign metaattributable=property> 20 | <#include "meta.hbm.ftl"> 21 | <#list c2h.getProperties(property.value) as property> 22 | <#include "${c2h.getTag(property)}.hbm.ftl"/> 23 | 24 | -------------------------------------------------------------------------------- /test/maven/src/it/generateHbm/postbuild.bsh: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | File file = new File(basedir, "target/generated-sources/Person.hbm.xml"); 19 | if (!file.isFile()) { 20 | throw new FileNotFoundException("Could not find generated HBM file: " + file); 21 | } 22 | -------------------------------------------------------------------------------- /test/maven/src/it/hbm2java/postbuild.bsh: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | File entity = new File(basedir, "target/generated-sources/Person.java"); 19 | if (!entity.isFile()) { 20 | throw new FileNotFoundException("Could not find generated JPA Entity: " + entity); 21 | } 22 | -------------------------------------------------------------------------------- /test/maven/src/it/transformHbm/postbuild.bsh: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | File file = new File(basedir, "src/main/resources/Foo.mapping.xml"); 20 | if (!file.isFile()) { 21 | throw new FileNotFoundException("Could not find generated HBM file: " + file); 22 | } 23 | -------------------------------------------------------------------------------- /test/nodb/src/test/java/org/hibernate/tool/hbm2x/hbm2hbmxml/OneToOneTest/Address.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.hibernate.tool.hbm2x.hbm2hbmxml.OneToOneTest; 20 | 21 | public class Address { 22 | 23 | int id; 24 | 25 | Person person; 26 | } 27 | -------------------------------------------------------------------------------- /test/nodb/src/test/java/org/hibernate/tool/hbm2x/hbm2hbmxml/OneToOneTest/Person.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.hibernate.tool.hbm2x.hbm2hbmxml.OneToOneTest; 20 | 21 | public class Person { 22 | 23 | int id; 24 | 25 | Address address; 26 | } 27 | -------------------------------------------------------------------------------- /test/maven/src/it/hbm2ddl/postbuild.bsh: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | File schema = new File(basedir, "target/generated-resources/schema.ddl"); 19 | if (!schema.isFile()) { 20 | throw new FileNotFoundException("Could not find generated schema file: " + schema); 21 | } 22 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2orm/simple-default/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Maven](https://maven.apache.org) installed 18 | - Issue the following commands from a command-line window opened in this folder: 19 | `mvn org.hibernate.tool:hibernate-tools-maven:${hibernate.version}:hbm2orm` -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/ant/JavaFormatter/formatting/Simple5One.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package formatting; 19 | 20 | @Override // intentional that his will give compile error. 21 | public 22 | class 23 | Simple5One { 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ant/docs/examples/classpath/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Ant](https://ant.apache.org) installed 18 | - Issue `ant -Dhibernate.version=${hibernate.version} -Dh2.version=${h2.version} -Djavaee-api.version=${javaee-api.version}` 19 | from a command-line window opened in this folder 20 | -------------------------------------------------------------------------------- /ant/docs/examples/jpa/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Ant](https://ant.apache.org) installed 18 | - Issue `ant -Dhibernate.version=${hibernate.version} -Dh2.version=${h2.version} -Djavaee-api.version=${javaee-api.version}` 19 | from a command-line window opened in this folder 20 | -------------------------------------------------------------------------------- /ant/docs/examples/native/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Ant](https://ant.apache.org) installed 18 | - Issue `ant -Dhibernate.version=${hibernate.version} -Dh2.version=${h2.version} -Djavaee-api.version=${javaee-api.version}` 19 | from a command-line window opened in this folder 20 | -------------------------------------------------------------------------------- /ant/src/it/java/org/hibernate/tool/ant/TutorialTestIT.java: -------------------------------------------------------------------------------- 1 | package org.hibernate.tool.ant; 2 | 3 | import org.hibernate.tool.it.ant.TestTemplate; 4 | import org.junit.jupiter.api.Test; 5 | 6 | public class TutorialTestIT extends TestTemplate { 7 | 8 | @Test 9 | public void testTutorial() throws Exception { 10 | setHibernateToolTaskXml( 11 | """ 12 | \s 13 | \s 14 | \s 15 | \s 16 | """ 17 | ); 18 | setDatabaseCreationScript(new String[] { 19 | "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))" 20 | }); 21 | createProjectAndBuild(); 22 | assertFolderExists("generated-sources", 1); 23 | assertFileExists("generated-sources/Person.java"); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/CollectionMetadataWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | public interface CollectionMetadataWrapper extends Wrapper { 21 | 22 | TypeWrapper getElementType(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/meta.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#if metaattributable.getMetaAttributes()?exists> 17 | <#list metaattributable.getMetaAttributes().keySet() as key> 18 | <#list metaattributable.getMetaAttributes().get(key).values as value> 19 | ${value} 20 | 21 | 22 | -------------------------------------------------------------------------------- /ant/docs/examples/properties/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Ant](https://ant.apache.org) installed 18 | - Issue `ant -Dhibernate.version=${hibernate.version} -Dh2.version=${h2.version} -Djavaee-api.version=${javaee-api.version}` 19 | from a command-line window opened in this folder 20 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/hbm2x/HibernateConfigurationExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2023-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbm2x; 19 | 20 | import org.hibernate.tool.internal.export.cfg.CfgExporter; 21 | 22 | public class HibernateConfigurationExporter extends CfgExporter {} 23 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/hbm2x/HibernateMappingExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2023-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbm2x; 19 | 20 | import org.hibernate.tool.internal.export.hbm.HbmExporter; 21 | 22 | public class HibernateMappingExporter extends HbmExporter { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2orm/with-user-type/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Maven](https://maven.apache.org) installed 18 | - Issue the following commands from a command-line window opened in this folder: 19 | `mvn compile org.hibernate.tool:hibernate-tools-maven:${hibernate.version}:hbm2orm` -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/column.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#if column.isFormula()> 17 | ${column.getFormula()} 18 | <#else> 19 | > 20 | ${column.comment} 21 | <#else>/> 22 | 23 | -------------------------------------------------------------------------------- /orm/src/main/resources/pojo/test.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | /** 17 | ${pojo.getClassJavaDoc(render.eval(ctx, pojo.getDeclarationName() + " generated by hbm2java"), 0)} 18 | */ 19 | ${templates.Ejb3TypeDeclaration} 20 | ${pojo.getClassModifiers()} ${pojo.getDeclarationType()} ${pojo.getDeclarationName()} ${pojo.getExtendsDeclaration()} ${pojo.getImplementsDeclaration()} -------------------------------------------------------------------------------- /utils/src/main/java/org/hibernate/tool/util/StringUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.util; 19 | 20 | public class StringUtil { 21 | 22 | public static boolean isEmptyOrNull(String string) { 23 | return string == null || string.isEmpty(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ant/docs/examples/configuration/default/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Ant](https://ant.apache.org) installed 18 | - Issue `ant -Dhibernate.version=${hibernate.version} -Dh2.version=${h2.version} -Djavaee-api.version=${javaee-api.version}` 19 | from a command-line window opened in this folder 20 | -------------------------------------------------------------------------------- /orm/src/main/resources/pojo/PojoTypeDeclaration.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | /** 17 | ${pojo.getClassJavaDoc(pojo.getDeclarationName() + " generated by hbm2java", 0)} 18 | */ 19 | <#include "Ejb3TypeDeclaration.ftl"/> 20 | ${pojo.getClassModifiers()} ${pojo.getDeclarationType()} ${pojo.getDeclarationName()} ${pojo.getExtendsDeclaration()} ${pojo.getImplementsDeclaration()} -------------------------------------------------------------------------------- /test/common/src/main/java/org/hibernate/tool/hbmlint/HbmLintTest/BrokenLazy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbmlint.HbmLintTest; 19 | 20 | public class BrokenLazy { 21 | 22 | long id; 23 | 24 | public BrokenLazy(long id) { 25 | this.id = id; 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/Properties/Pojo.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2004 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | hbm2java.weirdAl: ${.data_model["hbm2java.weirdAl"]} 17 | ant.project.name: ${.data_model["ant.project.name"]} 18 | <#if !.data_model["foo.weirdAl"]?exists>foo.weirdAl does not exist 19 | bar: ${bar} 20 | file: ${file} 21 | value: ${value} 22 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/RevengStrategyWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | public interface RevengStrategyWrapper extends Wrapper { 21 | 22 | void setSettings(RevengSettingsWrapper revengSettings); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/HqlCodeAssistWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | public interface HqlCodeAssistWrapper extends Wrapper { 21 | 22 | void codeComplete(String query, int position, Object handler); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /test/common/src/main/java/org/hibernate/tool/hbmlint/HbmLintTest/BrokenNonLazy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbmlint.HbmLintTest; 19 | 20 | public class BrokenNonLazy { 21 | 22 | long id; 23 | 24 | public BrokenNonLazy(long id) { 25 | this.id = id; 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/JoinWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.util.Iterator; 21 | 22 | public interface JoinWrapper extends Wrapper { 23 | 24 | Iterator getPropertyIterator(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /ant/README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | [![Hibernate](https://static.jboss.org/hibernate/images/hibernate_200x150.png)](https://tools.hibernate.org) 18 | 19 | # Hibernate Tools Ant Tasks 20 | 21 | This project contains a number of [Ant](https://ant.apache.org/) tasks that bring the power of the [Hibernate Tools API](../orm) to your Ant build script. 22 | 23 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/api/reveng/AssociationInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2010-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.api.reveng; 19 | 20 | public interface AssociationInfo { 21 | 22 | String getCascade(); 23 | String getFetch(); 24 | Boolean getUpdate(); 25 | Boolean getInsert(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/timestamp.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | access="${property.propertyAccessorName}" 19 | <#list property.columns as column> <#-- always only one column, but no direct access method.--> 20 | column="${column.quotedName}" 21 | /> 22 | 23 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/version.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | access="${property.propertyAccessorName}" 20 | > 21 | <#list property.columns as column> 22 | <#include "column.hbm.ftl"> 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/hbm2x/GenericExporterTest/generic-test.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2004 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#list ctx?keys as item> 17 | <#-- ${templates.create("generictemplates/pojo/generic-content", item + ".txt")} --> 18 | <#assign captured><#include "generic-content.ftl"/> 19 | ${templates.createFile(captured, "${item}.txt")} 20 | 21 | -------------------------------------------------------------------------------- /utils/README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | [![Hibernate](https://static.jboss.org/hibernate/images/hibernate_200x150.png)](https://tools.hibernate.org) 18 | 19 | # Hibernate Tools Utilities 20 | 21 | This project contains the common utilities that are used by the [Hibernate Tools API](../orm) as well as by the [Hibernate Tools Ant](../ant) projects. 22 | 23 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/Cfg2HbmToolWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | public interface Cfg2HbmToolWrapper extends Wrapper { 21 | 22 | String getTag(PersistentClassWrapper pcw); 23 | String getTag(PropertyWrapper pw); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/CriteriaWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.util.List; 21 | 22 | public interface CriteriaWrapper extends Wrapper { 23 | 24 | void setMaxResults(int intValue); 25 | List list(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/hbm2x/GenericExporterTest/generic-exception.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2004 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | ${pojo.getShortName()} 17 | ${pojo.shortName} 18 | 19 | <#list [1,2,3] as cl> 20 | <@greet person=cl/> 21 | 22 | 23 | 24 | <#macro greet person> 25 | Hello ${person} ${propertythatdoesnotexist}! 26 | 27 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/SchemaExportWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.util.List; 21 | 22 | public interface SchemaExportWrapper extends Wrapper { 23 | 24 | void create(); 25 | List getExceptions(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/internal/reveng/strategy/DefaultStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2020-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.internal.reveng.strategy; 19 | 20 | import org.hibernate.tool.api.reveng.RevengStrategy; 21 | 22 | public class DefaultStrategy extends AbstractStrategy implements RevengStrategy { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/hbm2x/Hbm2JavaTest/HelloWorld.java_: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | /** 20 | * @author max 21 | * NOTE: this file cannot compile without the tests being run since its dependent on its output. 22 | */ 23 | public interface HelloWorld extends generated.BaseHelloWorld { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /orm/src/main/resources/doc/index.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | Hibernate Mappings - Hibernate Mapping Information 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/hbm2x/PropertiesTest/PropertiesUsage.java_: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package properties; 19 | 20 | public class PropertiesUsage { 21 | 22 | public void personName(){ 23 | PPerson person = new PPerson(); 24 | person.setName( "name" ); 25 | person.setContact(true); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/DdlExporterWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.util.Properties; 21 | 22 | public interface DdlExporterWrapper extends Wrapper { 23 | 24 | void setExport(boolean b); 25 | Properties getProperties(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/api/metadata/MetadataConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2020-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.api.metadata; 19 | 20 | public interface MetadataConstants { 21 | 22 | public static final String PREFER_BASIC_COMPOSITE_IDS = "org.hibernate.tool.api.metadata.MetadataConstants.PreferBasicCompositeIds"; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/QueryExporterWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.util.List; 21 | 22 | public interface QueryExporterWrapper extends Wrapper { 23 | 24 | void setQueries(List queries); 25 | void setFilename(String fileName); 26 | 27 | } -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/DatabaseReaderWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.util.List; 21 | import java.util.Map; 22 | 23 | public interface DatabaseReaderWrapper extends Wrapper { 24 | Map> collectDatabaseTables(); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/internal/reveng/binder/PrimaryKeyInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2015-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.internal.reveng.binder; 19 | 20 | import java.util.Properties; 21 | 22 | public class PrimaryKeyInfo { 23 | 24 | public String suggestedStrategy = null; 25 | public Properties suggestedProperties = null; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/h2/src/test/java/org/hibernate/tool/test/db/h2/TestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.test.db.h2; 19 | 20 | import org.hibernate.tool.test.db.DbTestSuite; 21 | import org.junit.jupiter.api.Nested; 22 | 23 | public class TestSuite { 24 | 25 | @Nested 26 | public class H2TestSuite extends DbTestSuite {} 27 | 28 | } 29 | -------------------------------------------------------------------------------- /test/hsql/src/test/java/org/hibernate/tool/test/db/hsql/TestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.test.db.hsql; 19 | 20 | import org.hibernate.tool.test.db.DbTestSuite; 21 | import org.junit.jupiter.api.Nested; 22 | 23 | public class TestSuite { 24 | 25 | @Nested 26 | public class HSqlTestSuite extends DbTestSuite {} 27 | 28 | } 29 | -------------------------------------------------------------------------------- /test/mysql/src/test/java/org/hibernate/tool/test/db/mysql/TestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.test.db.mysql; 19 | 20 | import org.hibernate.tool.test.db.DbTestSuite; 21 | import org.junit.jupiter.api.Nested; 22 | 23 | public class TestSuite { 24 | 25 | @Nested 26 | public class MySqlTestSuite extends DbTestSuite {} 27 | 28 | } 29 | -------------------------------------------------------------------------------- /ant/docs/examples/templatepath/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Ant](https://ant.apache.org) installed 18 | - Have [H2 Sakila database](https://github.com/hibernate/sakila-h2) running 19 | - Issue `ant -Dhibernate.version=${hibernate.version} -Dh2.version=${h2.version} -Djavaee-api.version=${javaee-api.version}` 20 | from a command-line window opened in this folder 21 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/api/metadata/MetadataDescriptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2017-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.api.metadata; 19 | 20 | import java.util.Properties; 21 | 22 | import org.hibernate.boot.Metadata; 23 | 24 | public interface MetadataDescriptor { 25 | 26 | Metadata createMetadata(); 27 | 28 | Properties getProperties(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/filter-def.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#list md.filterDefinitions.keySet() as filterKey> 17 | <#assign filterDef = md.filterDefinitions.get(filterKey)> 18 | 19 | <#list filterDef.parameterNames as filterParaName> 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/common/src/main/java/org/hibernate/tool/ant/Query/ObjectResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.ant.Query; 19 | 20 | public class ObjectResult { 21 | 22 | public String id; 23 | public int length; 24 | 25 | @Override 26 | public String toString() { 27 | return "ObjectResult(id:" + id + ",length:" + length + ")"; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /test/mssql/src/test/java/org/hibernate/tool/test/db/sqlserver/TestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.test.db.sqlserver; 19 | 20 | import org.hibernate.tool.test.db.DbTestSuite; 21 | import org.junit.jupiter.api.Nested; 22 | 23 | public class TestSuite { 24 | 25 | @Nested 26 | public class MSSqlTestSuite extends DbTestSuite {} 27 | 28 | } 29 | -------------------------------------------------------------------------------- /ant/docs/examples/jpa/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Foo 23 | 24 | -------------------------------------------------------------------------------- /ant/docs/examples/5-minute-tutorial/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Ant](https://ant.apache.org) installed 18 | - Have [H2 Sakila database](https://github.com/hibernate/sakila-h2) running 19 | - Issue `ant -Dhibernate.version=${hibernate.version} -Dh2.version=${h2.version} -Djavaee-api.version=${javaee-api.version}` 20 | from a command-line window opened in this folder 21 | 22 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2java/jpa-default/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Maven](https://maven.apache.org) installed 18 | - Have [H2 Sakila database](https://github.com/hibernate/sakila-h2) running 19 | - Issue the following commands from a command-line window opened in this folder: 20 | `mvn generate-sources -Dh2.version=${h2.version} -Dhibernate.version=${hibernate.version}` 21 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2java/no-generics/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Maven](https://maven.apache.org) installed 18 | - Have [H2 Sakila database](https://github.com/hibernate/sakila-h2) running 19 | - Issue the following commands from a command-line window opened in this folder: 20 | `mvn generate-sources -Dh2.version=${h2.version} -Dhibernate.version=${hibernate.version}` 21 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2java/use-generics/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Maven](https://maven.apache.org) installed 18 | - Have [H2 Sakila database](https://github.com/hibernate/sakila-h2) running 19 | - Issue the following commands from a command-line window opened in this folder: 20 | `mvn generate-sources -Dh2.version=${h2.version} -Dhibernate.version=${hibernate.version}` 21 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/many-to-many-element.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | <#if property.value.referencedPropertyName?exists> 18 | property-ref="${property.value.referencedPropertyName}" 19 | > 20 | <#list elementValue.selectables as column> 21 | <#include "column.hbm.ftl"> 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/JPAPUnit/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 16 | 19 | 20 | 21 | 22 | true 23 | 24 | -------------------------------------------------------------------------------- /maven/docs/examples/5-minute-tutorial/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Maven](https://maven.apache.org) installed 18 | - Have [H2 Sakila database](https://github.com/hibernate/sakila-h2) running 19 | - Issue one of the following commands from a command-line window opened in this folder: 20 | - `mvn generate-sources -Dh2.version=${h2.version} -Dproject.version=${hibernate.version}` 21 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2java/no-annotations/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Maven](https://maven.apache.org) installed 18 | - Have [H2 Sakila database](https://github.com/hibernate/sakila-h2) running 19 | - Issue the following commands from a command-line window opened in this folder: 20 | `mvn generate-sources -Dh2.version=${h2.version} -Dhibernate.version=${hibernate.version}` 21 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/JPABogusPUnit/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 16 | 19 | 20 | 21 | 22 | true 23 | 24 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/EJB3Configuration/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 16 | 19 | 20 | 21 | 22 | true 23 | 24 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/ArtifactCollectorWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.io.File; 21 | import java.util.Set; 22 | 23 | public interface ArtifactCollectorWrapper extends Wrapper { 24 | 25 | Set getFileTypes(); 26 | void formatFiles(); 27 | File[] getFiles(String string); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /orm/src/main/resources/debug.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2004 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#macro dump var> 17 | <#if var?is_hash> 18 | { 19 | <#list var?keys as key> 20 | ${key}:< dump var[key]/>, 21 | 22 | } 23 | <#elseif var?is_sequence> 24 | [ 25 | <#list sequence as elem> 26 | < dump elem/>, 27 | 28 | ] 29 | <#else> 30 | ${var} 31 | 32 | 33 | 34 | <@dump .vars/> 35 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/JPAPropertyOverridesPUnit/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 16 | 19 | 20 | 21 | 22 | true 23 | 24 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/dynamic-component.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | 20 | access="${property.propertyAccessorName}" 21 | 22 | > 23 | <#assign metaattributable=property> 24 | <#include "meta.hbm.ftl"> 25 | <#list c2h.getProperties(property.value) as property> 26 | <#include "${c2h.getTag(property)}.hbm.ftl"/> 27 | 28 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/Query/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/component.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | 21 | access="${property.propertyAccessorName}" 22 | > 23 | <#assign metaattributable=property> 24 | <#include "meta.hbm.ftl"> 25 | <#list c2h.getProperties(property.value) as property> 26 | <#include "${c2h.getTag(property)}.hbm.ftl"/> 27 | 28 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/many-to-any-element.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | <#if elementValue.metaValues?exists> 18 | <#list elementValue.metaValues.entrySet() as entry> 19 | 20 | 21 | 22 | <#list elementValue.columns as column> 23 | <#include "column.hbm.ftl"> 24 | 25 | 26 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/composite-element.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | <#assign metaattributable=property> 18 | <#include "meta.hbm.ftl"> 19 | <#list elementValue.properties as property> 20 | <#assign tag=c2h.getTag(property)> 21 | <#if tag="component"> 22 | <#assign tag="nested-composite-element"> 23 | <#assign elementValue = property.value> 24 | 25 | <#include "${tag}.hbm.ftl"/> 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/hbm2x/GenericExporterTest/freemarker.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2004 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | ${pojo.getShortName()} 18 | ${pojo.shortName} 19 | 20 | <#list [1,2,3] as cl> 21 | <#include "freeinc.ftl"/> 22 | <#include "freeinc.ftl"/> 23 | <@greet person=cl/> 24 | 25 | 26 | 27 | <#macro greet person> 28 | Hello ${person} ${pojo.shortName}! 29 | 30 | 31 | 32 | <#list .data_model?keys as item> 33 | ${item} 34 | -------------------------------------------------------------------------------- /ant/docs/examples/configuration/fileset/simple.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/util/MockDialect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2022-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.internal.util; 19 | 20 | import org.hibernate.dialect.Dialect; 21 | import org.hibernate.dialect.SimpleDatabaseVersion; 22 | 23 | public class MockDialect extends Dialect { 24 | 25 | public MockDialect() { 26 | super(new SimpleDatabaseVersion(Integer.MAX_VALUE, Integer.MIN_VALUE)); 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2java/template-path/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Maven](https://maven.apache.org) installed 18 | - Have [H2 Sakila database](https://github.com/hibernate/sakila-h2) running 19 | - Issue the following command from a command-line window opened in this folder: 20 | ```shell 21 | mvn generate-sources 22 | -Dh2.version=${h2.version} 23 | -Dhibernate.version=${hibernate.version} 24 | -Dtemplate.dir=./templates 25 | ``` 26 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/ide/completion/ModelCompletion/StoreCity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.ide.completion.ModelCompletion; 19 | 20 | /** 21 | * @author leon 22 | */ 23 | public class StoreCity { 24 | 25 | private int number; 26 | 27 | public int getNumber() { 28 | return number; 29 | } 30 | 31 | public void setNumber(int number) { 32 | this.number = number; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/OverrideRepositoryWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.io.File; 21 | 22 | public interface OverrideRepositoryWrapper extends Wrapper { 23 | 24 | void addFile(File file); 25 | 26 | RevengStrategyWrapper getReverseEngineeringStrategy(RevengStrategyWrapper res); 27 | 28 | void addTableFilter(TableFilterWrapper tf); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/api/export/Exporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2010-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.api.export; 19 | 20 | import java.util.Properties; 21 | 22 | /** 23 | * @author max and david 24 | * @author koen 25 | */ 26 | public interface Exporter { 27 | 28 | 29 | public Properties getProperties(); 30 | 31 | /** 32 | * Called when exporter should start generating its output 33 | */ 34 | public void start(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/ide/completion/SimpleHQLLexer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2010-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.ide.completion; 19 | 20 | /** 21 | * Minimal lexer interface that allows HqlAnalyzer to work. 22 | * 23 | * @author Max Rydahl Andersen 24 | */ 25 | public interface SimpleHQLLexer { 26 | 27 | 28 | int nextTokenId() throws SimpleLexerException; 29 | 30 | int getTokenOffset(); 31 | 32 | int getTokenLength(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /gradle/README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | [![Hibernate](https://static.jboss.org/hibernate/images/hibernate_200x150.png)](https://tools.hibernate.org) 18 | 19 | # Hibernate Tools Gradle Plugin 20 | 21 | ## Overview 22 | 23 | This [Gradle](https://gradle.org/) plugin brings the power of the [Hibernate Tools API](../orm) to your Gradle build. If you are looking for a quick tutorial on the use of the Hibernate Tools Gradle plugin, we can refer you to the [5 minute tutorial](docs/5-minute-tutorial.md). 24 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/GenericExporterWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | public interface GenericExporterWrapper extends Wrapper { 21 | 22 | void setFilePattern(String filePattern); 23 | 24 | void setTemplateName(String templateName) ; 25 | 26 | void setForEach(String forEach); 27 | 28 | String getFilePattern(); 29 | 30 | String getTemplateName(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2java/output-directory/README.md: -------------------------------------------------------------------------------- 1 | 16 | To run this example: 17 | - Have [Apache Maven](https://maven.apache.org) installed 18 | - Have [H2 Sakila database](https://github.com/hibernate/sakila-h2) running 19 | - Issue the following command from a command-line window opened in this folder: 20 | ```shell 21 | mvn generate-sources 22 | -Dh2.version=${h2.version} 23 | -Dhibernate.version=${hibernate.version} 24 | -Doutput.dir=./generated-classes 25 | ``` 26 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/SessionWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | public interface SessionWrapper extends Wrapper { 21 | 22 | String getEntityName(Object o) ; 23 | SessionFactoryWrapper getSessionFactory(); 24 | QueryWrapper createQuery(String s); 25 | boolean isOpen(); 26 | void close(); 27 | boolean contains(Object o); 28 | QueryWrapper createCriteria(Class c); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /test/maven/src/it/hbm2dao/prebuild.bsh: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import java.sql.DriverManager; 19 | import java.sql.Connection; 20 | 21 | String JDBC_CONNECTION = "jdbc:h2:" + basedir + "/test"; 22 | String CREATE_PERSON_TABLE = "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))"; 23 | 24 | Connection connection = DriverManager.getConnection(JDBC_CONNECTION); 25 | connection.createStatement().execute(CREATE_PERSON_TABLE); 26 | connection.close(); 27 | -------------------------------------------------------------------------------- /test/maven/src/it/hbm2ddl/prebuild.bsh: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import java.sql.DriverManager; 19 | import java.sql.Connection; 20 | 21 | String JDBC_CONNECTION = "jdbc:h2:" + basedir + "/test"; 22 | String CREATE_PERSON_TABLE = "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))"; 23 | 24 | Connection connection = DriverManager.getConnection(JDBC_CONNECTION); 25 | connection.createStatement().execute(CREATE_PERSON_TABLE); 26 | connection.close(); 27 | -------------------------------------------------------------------------------- /test/nodb/src/test/java/org/hibernate/tool/hbm2x/hbm2hbmxml/IdBagTest/Group.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.hbm2x.hbm2hbmxml.IdBagTest; 19 | 20 | public class Group { 21 | private String name; 22 | 23 | Group() {} 24 | 25 | public Group(String name) { 26 | this.name = name; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | void setName(String name) { 34 | this.name = name; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /ant/docs/examples/classpath/additional/src/HelloExporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import org.hibernate.tool.api.export.Exporter; 19 | 20 | import java.util.Properties; 21 | 22 | public class HelloExporter implements Exporter { 23 | 24 | @Override 25 | public Properties getProperties() { 26 | return new Properties(); 27 | } 28 | 29 | @Override 30 | public void start() { 31 | System.out.println("Hello from Exporter!"); 32 | } 33 | } -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/RevengSettingsWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | public interface RevengSettingsWrapper extends Wrapper { 21 | 22 | RevengSettingsWrapper setDefaultPackageName(String s); 23 | RevengSettingsWrapper setDetectManyToMany(boolean b); 24 | RevengSettingsWrapper setDetectOneToOne(boolean b); 25 | RevengSettingsWrapper setDetectOptimisticLock(boolean b); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2orm/simple-default/src/main/resources/simple.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /maven/src/functionalTest/resources/org/hibernate/tool/maven/simple.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/ide/completion/IHQLCompletionRequestor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2010-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.ide.completion; 19 | 20 | 21 | /** 22 | * The interface to implement to collect completion proposals. 23 | * 24 | * @author Max Rydahl Andersen 25 | * 26 | */ 27 | public interface IHQLCompletionRequestor { 28 | 29 | boolean accept(HQLCompletionProposal proposal); 30 | 31 | void completionFailure(String errorMessage); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /test/maven/src/it/generateHbm/prebuild.bsh: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import java.sql.DriverManager; 19 | import java.sql.Connection; 20 | 21 | String JDBC_CONNECTION = "jdbc:h2:" + basedir + "/test"; 22 | String CREATE_PERSON_TABLE = "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))"; 23 | 24 | Connection connection = DriverManager.getConnection(JDBC_CONNECTION); 25 | connection.createStatement().execute(CREATE_PERSON_TABLE); 26 | connection.close(); 27 | -------------------------------------------------------------------------------- /test/maven/src/it/hbm2java/prebuild.bsh: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | import java.sql.DriverManager; 19 | import java.sql.Connection; 20 | 21 | String JDBC_CONNECTION = "jdbc:h2:" + basedir + "/test"; 22 | String CREATE_PERSON_TABLE = "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))"; 23 | 24 | Connection connection = DriverManager.getConnection(JDBC_CONNECTION); 25 | connection.createStatement().execute(CREATE_PERSON_TABLE); 26 | connection.close(); 27 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/internal/export/java/NoopImportContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2010-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.internal.export.java; 19 | 20 | public class NoopImportContext implements ImportContext { 21 | 22 | public String importType(String fqcn) { 23 | return fqcn; 24 | } 25 | 26 | public String staticImport(String fqcn, String member) { 27 | return fqcn; 28 | } 29 | 30 | public String generateImports() { 31 | return ""; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/nested-composite-element.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | 17 | <#assign metaattributable=property> 18 | <#include "meta.hbm.ftl"> 19 | <#list elementValue.properties as property> 20 | <#assign tag=c2h.getTag(property)> 21 | <#if tag="component"> 22 | <#assign tag="nested-composite-element"> 23 | <#assign elementValue = property.value> 24 | 25 | <#include "${tag}.hbm.ftl"/> 26 | 27 | 28 | -------------------------------------------------------------------------------- /test/h2/src/test/resources/org/hibernate/tool/entitynaming/reveng.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/TableFilterWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | public interface TableFilterWrapper extends Wrapper { 21 | 22 | void setExclude(boolean b); 23 | void setMatchCatalog(String s); 24 | void setMatchSchema(String s); 25 | void setMatchName(String s); 26 | Boolean getExclude(); 27 | String getMatchCatalog(); 28 | String getMatchSchema(); 29 | String getMatchName(); 30 | } 31 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2orm/with-user-type/src/main/resources/user-type.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /orm/src/main/resources/pojo/PojoFields.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#-- // Fields --> 17 | 18 | <#list pojo.getAllPropertiesIterator() as field><#if pojo.getMetaAttribAsBool(field, "gen-property", true)> <#if pojo.hasMetaAttribute(field, "field-description")> /** 19 | ${pojo.getFieldJavaDoc(field, 0)} 20 | */ 21 | ${pojo.getFieldModifiers(field)} ${pojo.getJavaTypeName(field, jdk5)} ${c2j.keyWordCheck(field.name)}<#if pojo.hasFieldInitializor(field, jdk5)> = ${pojo.getFieldInitialization(field, jdk5)}; 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/common/src/main/java/org/hibernate/tool/ant/Query/SerializableResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.ant.Query; 19 | 20 | import java.io.Serializable; 21 | 22 | @SuppressWarnings("serial") 23 | public class SerializableResult implements Serializable { 24 | 25 | public String id; 26 | public int length; 27 | 28 | @Override 29 | public String toString() { 30 | return "SerializableResult(id:" + id + ",length:" + length + ")"; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/Properties/SomeClass.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/api/version/Version.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018q-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.api.version; 19 | 20 | public interface Version { 21 | 22 | /** 23 | * @deprecated Use {@link #versionString()} instead. 24 | */ 25 | @Deprecated 26 | final static String CURRENT_VERSION = versionString(); 27 | 28 | static String versionString() { 29 | // This implementation is replaced during the build with another one that returns the correct value. 30 | return "UNKNOWN"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/Hbm2JavaConfiguration/SomeClass.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/Hbm2JavaEJB3Configuration/SomeClass.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/HbmExporterWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.io.File; 21 | import java.util.Map; 22 | 23 | public interface HbmExporterWrapper extends Wrapper { 24 | 25 | void start(); 26 | 27 | File getOutputDirectory(); 28 | 29 | void setOutputDirectory(File f); 30 | 31 | void exportPOJO(Map map, Object pojoClass); 32 | 33 | void setExportPOJODelegate(Object delegate); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /test/common/src/main/java/org/hibernate/tool/ant/Cfg2HbmWithCustomReverseNamingStrategy/Strategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.ant.Cfg2HbmWithCustomReverseNamingStrategy; 19 | 20 | import org.hibernate.tool.api.reveng.TableIdentifier; 21 | import org.hibernate.tool.internal.reveng.strategy.AbstractStrategy; 22 | 23 | public class Strategy extends AbstractStrategy { 24 | 25 | public String tableToClassName(TableIdentifier tableIdentifier) { 26 | return "foo.Bar"; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2orm/simple-default/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 4.0.0 21 | 22 | org.hibernate.tool.maven.test 23 | hbm2orm-simple-default 24 | 0.0.1-SNAPSHOT 25 | 26 | -------------------------------------------------------------------------------- /maven/docs/examples/hbm2orm/with-user-type/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 4.0.0 21 | 22 | org.hibernate.tool.maven.test 23 | hbm2orm-simple-default 24 | 0.0.1-SNAPSHOT 25 | 26 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/ant/Exception/TopDown.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/common/src/main/java/org/hibernate/tool/ant/Cfg2HbmWithPackageNameAndReverseNamingStrategy/Strategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.ant.Cfg2HbmWithPackageNameAndReverseNamingStrategy; 19 | 20 | import org.hibernate.tool.api.reveng.TableIdentifier; 21 | import org.hibernate.tool.internal.reveng.strategy.AbstractStrategy; 22 | 23 | public class Strategy extends AbstractStrategy { 24 | 25 | public String tableToClassName(TableIdentifier tableIdentifier) { 26 | return "Bar"; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/ant/NoConnInfoExport/TopDown.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/nodb/src/test/resources/org/hibernate/tool/ide/completion/ModelCompletion/StoreCity.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/maven/src/it/hbm2java/src/main/resources/templates/pojo/PojoFields.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2018 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#-- // Fields --> 17 | <#list pojo.getAllPropertiesIterator() as field><#if pojo.getMetaAttribAsBool(field, "gen-property", true)><#if pojo.hasMetaAttribute(field, "field-description")> /** 18 | ${pojo.getFieldJavaDoc(field, 0)} 19 | */ 20 | ${pojo.getFieldModifiers(field)} ${pojo.getJavaTypeName(field, jdk5)} ${c2j.keyWordCheck(field.name)}<#if pojo.hasFieldInitializor(field, jdk5)> = ${pojo.getFieldInitialization(field, jdk5)}; 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/maven/src/it/generateHbm/src/main/resources/templates/pojo/PojoFields.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2018 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#-- // Fields --> 17 | <#list pojo.getAllPropertiesIterator() as field><#if pojo.getMetaAttribAsBool(field, "gen-property", true)><#if pojo.hasMetaAttribute(field, "field-description")> /** 18 | ${pojo.getFieldJavaDoc(field, 0)} 19 | */ 20 | ${pojo.getFieldModifiers(field)} ${pojo.getJavaTypeName(field, jdk5)} ${c2j.keyWordCheck(field.name)}<#if pojo.hasFieldInitializor(field, jdk5)> = ${pojo.getFieldInitialization(field, jdk5)}; 21 | 22 | 23 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/internal/wrp/AbstractWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.internal.wrp; 19 | 20 | import org.hibernate.tool.orm.jbt.api.wrp.Wrapper; 21 | 22 | public abstract class AbstractWrapper implements Wrapper { 23 | 24 | @Override 25 | public boolean equals(Object o) { 26 | if (o == null) return false; 27 | if (!Wrapper.class.isAssignableFrom(o.getClass())) return false; 28 | return getWrappedObject().equals(((Wrapper)o).getWrappedObject()); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/api/export/ArtifactCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.api.export; 19 | 20 | import java.io.File; 21 | import java.util.Set; 22 | 23 | public interface ArtifactCollector { 24 | 25 | /** 26 | * Called to inform that a file has been created by the exporter. 27 | */ 28 | void addFile(File file, String type); 29 | 30 | int getFileCount(String type); 31 | 32 | File[] getFiles(String type); 33 | 34 | Set getFileTypes(); 35 | 36 | void formatFiles(); 37 | 38 | } -------------------------------------------------------------------------------- /utils/src/main/java/org/hibernate/tool/util/ReflectionUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.util; 19 | 20 | public class ReflectionUtil { 21 | 22 | public static Class classForName(String name) throws ClassNotFoundException { 23 | try { 24 | ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 25 | if ( classLoader != null ) { 26 | return classLoader.loadClass(name); 27 | } 28 | } 29 | catch ( Throwable ignore ) {} 30 | return Class.forName( name ); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/ForeignKeyWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.util.Iterator; 21 | import java.util.List; 22 | 23 | public interface ForeignKeyWrapper extends Wrapper { 24 | 25 | TableWrapper getReferencedTable(); 26 | 27 | Iterator columnIterator(); 28 | 29 | boolean isReferenceToPrimaryKey(); 30 | 31 | List getReferencedColumns(); 32 | 33 | boolean containsColumn(ColumnWrapper column); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/internal/reveng/util/EnhancedValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.internal.reveng.util; 19 | 20 | import java.util.Properties; 21 | 22 | import org.hibernate.mapping.KeyValue; 23 | 24 | public interface EnhancedValue extends KeyValue { 25 | 26 | void setIdentifierGeneratorProperties(Properties suggestedProperties); 27 | 28 | Properties getIdentifierGeneratorProperties(); 29 | 30 | void setIdentifierGeneratorStrategy(String s); 31 | 32 | String getIdentifierGeneratorStrategy(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /test/utils/src/test/resources/org/hibernate/tools/test/util/HelloWorld.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/internal/export/lint/Detector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2010-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.internal.export.lint; 19 | 20 | import org.hibernate.boot.Metadata; 21 | 22 | public abstract class Detector { 23 | 24 | private Metadata metadata; 25 | 26 | public void initialize(Metadata metadata) { 27 | this.metadata = metadata; 28 | } 29 | 30 | protected Metadata getMetadata() { 31 | return metadata; 32 | } 33 | 34 | abstract public void visit(IssueCollector collector); 35 | 36 | abstract public String getName(); 37 | } 38 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/Cfg2HbmNoError/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /utils/src/test/java/org/hibernate/tool/util/StringUtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.util; 19 | 20 | import static org.junit.jupiter.api.Assertions.assertFalse; 21 | import static org.junit.jupiter.api.Assertions.assertTrue; 22 | 23 | import org.junit.jupiter.api.Test; 24 | 25 | public class StringUtilTest { 26 | 27 | @Test 28 | public void testIsEmptyOrNull() { 29 | assertTrue(StringUtil.isEmptyOrNull(null)); 30 | assertTrue(StringUtil.isEmptyOrNull("")); 31 | assertFalse(StringUtil.isEmptyOrNull("foo")); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ant/docs/examples/native/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | org.h2.Driver 23 | url_to_be_overridden_in_hibernate_properties 24 | 25 | 26 | -------------------------------------------------------------------------------- /orm/src/main/resources/hbm/collection-tableattr.hbm.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | table="${value.collectionTable.quotedName}" 17 | <#if value.collectionTable.catalog?exists && ((clazz.table.catalog?exists && clazz.table.catalog!=value.collectionTable.catalog) || (!clazz.table.catalog?exists && value.collectionTable.catalog?exists)) > 18 | catalog="${value.collectionTable.catalog}" 19 | 20 | <#if value.collectionTable.schema?exists && ((clazz.table.schema?exists && clazz.table.schema!=value.collectionTable.schema) || (!clazz.table.schema?exists && value.collectionTable.schema?exists)) > 21 | schema="${value.collectionTable.quotedSchema}" 22 | -------------------------------------------------------------------------------- /orm/src/main/resources/pojo/PojoToString.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#if pojo.needsToString()> /** 17 | * toString 18 | * @return String 19 | */ 20 | public String toString() { 21 | StringBuffer buffer = new StringBuffer(); 22 | 23 | buffer.append(getClass().getName()).append("@").append(Integer.toHexString(hashCode())).append(" ["); 24 | <#list pojo.getToStringPropertiesIterator() as property> buffer.append("${property.getName()}").append("='").append(${pojo.getGetterSignature(property)}()).append("' "); 25 | buffer.append("]"); 26 | 27 | return buffer.toString(); 28 | } 29 | -------------------------------------------------------------------------------- /ant/src/test/java/org/hibernate/tool/ant/test/util/ProjectUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2004-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.ant.test.util; 19 | 20 | import java.io.File; 21 | 22 | import org.apache.tools.ant.Project; 23 | import org.apache.tools.ant.ProjectHelper; 24 | 25 | public class ProjectUtil { 26 | 27 | public static Project createProject(File file) { 28 | Project project = new Project(); 29 | project.init(); 30 | ProjectHelper projectHelper = ProjectHelper.getProjectHelper(); 31 | projectHelper.parse(project, file); 32 | return project; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/GenericExport/TopDown.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /orm/src/main/resources/pojo/PojoInterfacePropertyAccessors.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#-- if interface --> 17 | <#-- Property accessors for interface --> 18 | <#list pojo.getAllPropertiesIterator() as property><#if pojo.getMetaAttribAsBool(property, "gen-property", true)> /** 19 | ${c2j.toJavaDoc(c2j.getMetaAsString(property, "field-description"), 4)} */ 20 | ${pojo.getPropertyGetModifiers(property)} ${pojo.getJavaTypeName(property, jdk5)} ${pojo.getGetterSignature(property)}(); 21 | 22 | ${pojo.getPropertySetModifiers(property)} void set${pojo.getPropertyName(property)}(${pojo.getJavaTypeName(property, jdk5)} ${property.name}); 23 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/AntHibernateTool/TopDown.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/SchemaExportWarning/TopDown.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/SchemaUpdateWarning/TopDown.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /orm/README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | [![Hibernate](https://static.jboss.org/hibernate/images/hibernate_200x150.png)](https://tools.hibernate.org) 18 | 19 | # Hibernate Tools ORM 20 | 21 | This project contains API and an implementation that allow you to perform reverse engineering on existing databases and generate artifacts such as JPA classes or Hibernate mapping files from the database information. 22 | 23 | The tools in this module can be used as you like in your code but for your convenience they have been wrapped in a number of [Hibernate Tools Ant tasks](../ant) and in a [Hibernate Tools Maven plugin](../maven). 24 | 25 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/PrimaryKeyWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.util.Iterator; 21 | import java.util.List; 22 | 23 | public interface PrimaryKeyWrapper extends Wrapper { 24 | 25 | void addColumn(ColumnWrapper column); 26 | int getColumnSpan(); 27 | List getColumns(); 28 | ColumnWrapper getColumn(int i); 29 | TableWrapper getTable(); 30 | boolean containsColumn(ColumnWrapper column); 31 | Iterator columnIterator(); 32 | String getName(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /orm/src/main/java/org/hibernate/tool/internal/util/TableNameQualifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2016-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.internal.util; 19 | 20 | public class TableNameQualifier { 21 | 22 | public static String qualify(String catalog, String schema, String table) { 23 | StringBuilder qualifiedName = new StringBuilder(); 24 | if ( catalog != null ) { 25 | qualifiedName.append( catalog ).append( '.' ); 26 | } 27 | if ( schema != null ) { 28 | qualifiedName.append( schema ).append( '.' ); 29 | } 30 | return qualifiedName.append( table ).toString(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /jbt/src/main/java/org/hibernate/tool/orm/jbt/api/wrp/QueryWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2024-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.orm.jbt.api.wrp; 19 | 20 | import java.util.List; 21 | 22 | public interface QueryWrapper extends Wrapper { 23 | 24 | List list(); 25 | void setMaxResults(int i); 26 | void setParameterList(String parameter, List list, Object anything); 27 | void setParameter(String parameter, Object value, Object anything); 28 | void setParameter(int position, Object value, Object anything); 29 | String[] getReturnAliases(); 30 | TypeWrapper[] getReturnTypes(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/HbmLint/hibernate.cfg.xml: -------------------------------------------------------------------------------- 1 | 16 | 19 | 20 | 21 | 22 | true 23 | 24 | create 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/JDBCConfigWithRevEngXml/hibernate.reveng.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/jdbc2cfg/RevEngForeignKey/badforeignkeytest.reveng.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 |
26 | 27 |
-------------------------------------------------------------------------------- /gradle/plugin/src/functionalTest/java/org/hibernate/tool/gradle/TutorialTest.java: -------------------------------------------------------------------------------- 1 | package org.hibernate.tool.gradle; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertEquals; 4 | import static org.junit.jupiter.api.Assertions.assertTrue; 5 | 6 | import java.io.File; 7 | 8 | import org.junit.jupiter.api.BeforeEach; 9 | import org.junit.jupiter.api.Test; 10 | 11 | import org.hibernate.tool.it.gradle.TestTemplate; 12 | 13 | public class TutorialTest extends TestTemplate { 14 | 15 | @BeforeEach 16 | public void beforeEach() { 17 | setGradleTaskToPerform("generateJava"); 18 | setDatabaseCreationScript(new String[] { 19 | "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))" 20 | }); 21 | } 22 | 23 | @Test 24 | public void testTutorial() throws Exception { 25 | createProjectAndExecuteGradleCommand(); 26 | File generatedOutputFolder = new File(getProjectDir(), "app/generated-sources"); 27 | assertTrue(generatedOutputFolder.exists()); 28 | assertTrue(generatedOutputFolder.isDirectory()); 29 | assertEquals(1, generatedOutputFolder.list().length); 30 | File generatedPersonJavaFile = new File(generatedOutputFolder, "Person.java"); 31 | assertTrue(generatedPersonJavaFile.exists()); 32 | assertTrue(generatedPersonJavaFile.isFile()); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /test/common/src/main/resources/org/hibernate/tool/ant/SchemaUpdateWarning/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /orm/src/test/java/org/hibernate/tool/api/export/ExporterTypeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Hibernate Tools, Tooling for your Hibernate Projects 3 | * 4 | * Copyright 2018-2025 Red Hat, Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" basis, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.hibernate.tool.api.export; 19 | 20 | import static org.junit.jupiter.api.Assertions.assertEquals; 21 | 22 | import org.junit.jupiter.api.Test; 23 | 24 | public class ExporterTypeTest { 25 | 26 | @Test 27 | public void testExporterType() { 28 | assertEquals( 29 | "org.hibernate.tool.internal.export.java.JavaExporter", 30 | ExporterType.JAVA.className()); 31 | assertEquals( 32 | "org.hibernate.tool.internal.export.cfg.CfgExporter", 33 | ExporterType.CFG.className()); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /orm/src/main/resources/pojo/Ejb3TypeDeclaration.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | <#if ejb3?if_exists> 17 | <#if pojo.isComponent()> 18 | @${pojo.importType("jakarta.persistence.Embeddable")} 19 | <#else> 20 | @${pojo.importType("jakarta.persistence.Entity")} 21 | @${pojo.importType("jakarta.persistence.Table")}(name="${clazz.table.name}" 22 | <#if clazz.table.schema?exists> 23 | ,schema="${clazz.table.schema}" 24 | <#if clazz.table.catalog?exists> 25 | ,catalog="${clazz.table.catalog}" 26 | 27 | <#assign uniqueConstraint=pojo.generateAnnTableUniqueConstraint()> 28 | <#if uniqueConstraint?has_content> 29 | , uniqueConstraints = ${uniqueConstraint} 30 | ) 31 | 32 | -------------------------------------------------------------------------------- /orm/src/main/resources/pojo/Pojo.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | ~ Copyright 2010 - 2025 Red Hat, Inc. 3 | ~ 4 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 | ~ you may not use this file except in compliance with the License. 6 | ~ You may obtain a copy of the License at 7 | ~ 8 | ~ http://www.apache.org/licenses/LICENSE-2.0 9 | ~ 10 | ~ Unless required by applicable law or agreed to in writing, software 11 | ~ distributed under the License is distributed on an "AS IS" basis, 12 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ~ See the License for the specific language governing permissions and 14 | ~ limitations under the License. 15 | --> 16 | ${pojo.getPackageDeclaration()} 17 | // Generated ${date} by Hibernate Tools ${version} 18 | 19 | <#assign classbody> 20 | <#include "PojoTypeDeclaration.ftl"/> { 21 | 22 | <#if !pojo.isInterface()> 23 | <#include "PojoFields.ftl"/> 24 | 25 | <#include "PojoConstructors.ftl"/> 26 | 27 | <#include "PojoPropertyAccessors.ftl"/> 28 | 29 | <#include "PojoToString.ftl"/> 30 | 31 | <#include "PojoEqualsHashcode.ftl"/> 32 | 33 | <#else> 34 | <#include "PojoInterfacePropertyAccessors.ftl"/> 35 | 36 | 37 | <#include "PojoExtraClassCode.ftl"/> 38 | 39 | } 40 | 41 | 42 | ${pojo.generateImports()} 43 | ${classbody} 44 | 45 | --------------------------------------------------------------------------------