alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (metadata-complete.xml)

This example Hibernate source code file (metadata-complete.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

administration, administration, bustrip, bustrippk, bustrippk, field, field, lazy, match, organization, socialsecuritymoralaccount, utf-8, utf-8

The Hibernate metadata-complete.xml source code

<?xml version="1.0" encoding="UTF-8"?>

<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
                 version="2.0"
        >
    <persistence-unit-metadata>
        <xml-mapping-metadata-complete/>
        <persistence-unit-defaults>
            <schema>myschema
            <catalog>mycatalog
            <cascade-persist/>
        </persistence-unit-defaults>
    </persistence-unit-metadata>
    <package>org.hibernate.test.annotations.reflection
    <mapped-superclass class="Organization">
        <attributes>
            <basic name="organizationId"/>
        </attributes>
    </mapped-superclass>
    <entity class="Administration">
        <attributes>
            <id name="id"/>
        </attributes>
    </entity>
    <entity class="Match">
    </entity>
    <entity class="SocialSecurityMoralAccount"/>
    <entity class="BusTrip" access="FIELD">
        <attributes>
            <embedded-id name="id">
                <attribute-override name="busDriver">
                    <column name="fld_busdriver"/>
                </attribute-override>
            </embedded-id>
            <basic name="status" optional="false">
                <enumerated>STRING
            </basic>
            <basic name="serial" optional="true">
                <column name="serialbytes"/>
                <lob/>
            </basic>
            <basic name="terminusTime" fetch="LAZY">
                <temporal>TIMESTAMP
            </basic>
            <one-to-many name="players">
                <map-key name="name"/>
                <join-column name="driver"/>
                <join-column name="number"/>
            </one-to-many>
            <many-to-many name="roads" target-entity="Administration">
                <order-by>maxSpeed
                <join-table name="bus_road">
                    <join-column name="driver"/>
                    <join-column name="number"/>
                    <inverse-join-column name="road_id"/>
                    <unique-constraint>
                        <column-name>driver
                        <column-name>number
                    </unique-constraint>
                </join-table>
            </many-to-many>
        </attributes>
    </entity>
    <embeddable class="BusTripPk" access="FIELD">
        <attributes>
            <basic name="busDriver">
                <column name="busdriver"/>
            </basic>
            <basic name="busNumber">
                <column name="busnumber"/>
            </basic>
        </attributes>
    </embeddable>
</entity-mappings>

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate metadata-complete.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.