|
Hibernate example source code file (Documents.hbm.xml)
The Hibernate Documents.hbm.xml source code<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <!-- This mapping demonstrates (1) use of lazy properties - this feature requires buildtime bytecode instrumentation; we don't think this is a very necessary feature, but provide it for completeleness; if Hibernate encounters uninstrumented classes, lazy property fetching will be silently disabled, to enable testing (2) use of a formula to define a "derived property" --> <hibernate-mapping package="org.hibernate.test.instrument.domain" default-access="field"> <class name="Folder" table="folders"> <id name="id"> <generator class="increment"/> </id> <property name="name" not-null="true" length="50"/> <many-to-one name="parent"/> <bag name="subfolders" inverse="true" cascade="save-update"> <key column="parent"/> <one-to-many class="Folder"/> </bag> <bag name="documents" inverse="true" cascade="all-delete-orphan"> <key column="folder"/> <one-to-many class="Document"/> </bag> </class> <class name="Owner" table="owners" lazy="false"> <id name="id"> <generator class="increment"/> </id> <property name="name" not-null="true" length="50"/> </class> <class name="Document" table="documents"> <id name="id"> <generator class="increment"/> </id> <property name="name" not-null="true" length="50"/> <property name="upperCaseName" formula="upper(name)" lazy="true"/> <property name="summary" not-null="true" length="200" lazy="true"/> <many-to-one name="folder" not-null="true" lazy="no-proxy"/> <many-to-one name="owner" not-null="true" lazy="no-proxy" fetch="select"/> <property name="text" not-null="true" length="2000" lazy="true"/> <property name="lastTextModification" not-null="true" lazy="true" access="field"/> <property name="sizeKb" lazy="true"> <column name="size_mb" read="size_mb * 1024.0" write="? / cast( 1024.0 as float )"/> </property> </class> <class name="Entity" table="entity"> <id name="id" column="ID" type="long"> <generator class="increment"/> </id> <property name="name" column="NAME" type="string" lazy="true"/> <many-to-one name="child" column="PRNT_ID" class="Entity" lazy="proxy" cascade="all" /> <many-to-one name="sibling" column="RIGHT_ID" class="Entity" lazy="no-proxy" cascade="all" /> </class> </hibernate-mapping> Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate Documents.hbm.xml source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
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.