Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions ant/docs/examples/native/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
############################################################################
# Hibernate Tools, Tooling for your Hibernate Projects #
# #
# Copyright 2004-2025 Red Hat, Inc. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
# You may obtain a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" basis, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
############################################################################
generated-sources
*.class
6 changes: 6 additions & 0 deletions ant/docs/examples/native/Foo.hbm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<hibernate-mapping>
<class name="Foo">
<id name="id"/>
<property name="bar" type="string"/>
</class>
</hibernate-mapping>
10 changes: 10 additions & 0 deletions ant/docs/examples/native/Foo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
public class Foo {

public int id;
public String bar;

}
18 changes: 18 additions & 0 deletions ant/docs/examples/native/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
~ Copyright 2004 - 2025 Red Hat, Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" basis,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
To run this example:
- Have [Apache Ant](https://ant.apache.org) installed
- Issue `ant` from a command-line window
42 changes: 42 additions & 0 deletions ant/docs/examples/native/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!--
~ Copyright 2004 - 2025 Red Hat, Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" basis,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project name="native" default="reveng">

<!-- Include the 'hibernatetool' task definition from the file '../common/included.xml' -->
<include file="../common/included.xml"/>

<target name="clean">
<!-- Delete the folder 'generated-sources' if it exists -->
<delete dir="generated-sources"/>
<delete file="Foo.class"/>
</target>

<target name="compile" depends="clean">
<!-- Compile the custom exporter 'HelloExporter' -->
<javac srcdir="." destdir="." classpathref="classpath"/>
</target>

<target name="reveng" depends="compile">
<hibernatetool destdir="generated-sources">
<classpath location="."/>
<!-- Native configuration read from 'hibernate.cfg.xml' -->
<configuration configurationfile="hibernate.cfg.xml"/>
<hbm2ddl outputfilename="foo.sql"/>
</hibernatetool>
</target>

</project>

10 changes: 10 additions & 0 deletions ant/docs/examples/native/hibernate.cfg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.h2.Driver</property>
<property name="hibernate.connection.url">jdbc:h2:mem:</property>
<property name="hibernate.connection.username">sa</property>
<mapping resource="Foo.hbm.xml"/>
</session-factory>
</hibernate-configuration>