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

Hibernate example source code file (FunctionNamesAsColumns.hbm.xml)

This example Hibernate source code file (FunctionNamesAsColumns.hbm.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

doctype, entity_with_arg_fn_as_col, entity_with_fn_as_col_holder, entity_with_noarg_fn_as_col, entitywithargfunctionascolumn, entitywithargfunctionascolumn, entitywithfunctionascolumnholder, entitywithnoargfunctionascolumn, entitywithnoargfunctionascolumn, holder_id, holder_id, id, id, system

The Hibernate FunctionNamesAsColumns.hbm.xml source code

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping SYSTEM "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="org.hibernate.test.hql">

    <class name="EntityWithFunctionAsColumnHolder" table="ENTITY_WITH_FN_AS_COL_HOLDER">
        <id name="id" column="ID" type="long">
            <generator class="increment"/>
        </id>
        <many-to-one name="nextHolder" cascade="all"/>
        <set name="entityWithArgFunctionAsColumns" inverse="false" lazy="true" cascade="all-delete-orphan"
             order-by="lower,lower( upper )">
            <key column="HOLDER_ID"/>
            <one-to-many class="EntityWithArgFunctionAsColumn"/>
        </set>
        <set name="entityWithNoArgFunctionAsColumns" inverse="false" lazy="true" cascade="all-delete-orphan"
                order-by="current_date, `current_date`">
            <key column="HOLDER_ID"/>
            <one-to-many class="EntityWithNoArgFunctionAsColumn"/>
        </set>
    </class>

    <class name="EntityWithArgFunctionAsColumn" table="ENTITY_WITH_ARG_FN_AS_COL">
        <id name="id" column="ID" type="long">
            <generator class="increment"/>
        </id>
        <property name="lower" column="lower" type="int"/>
        <property name="upper" column="upper" type="string"/>
    </class>

    <class name="EntityWithNoArgFunctionAsColumn" table="ENTITY_WITH_NOARG_FN_AS_COL">
        <id name="id" column="ID" type="long">
            <generator class="increment"/>
        </id>
        <property name="currentDate" column="`current_date`" type="string"/>
    </class>

</hibernate-mapping>

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate FunctionNamesAsColumns.hbm.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.