~ubuntu-branches/ubuntu/wily/libhibernate3-java/wily-proposed

« back to all changes in this revision

Viewing changes to test/org/hibernate/test/cid/Product.hbm.xml

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-10-14 14:43:34 UTC
  • Revision ID: james.westby@ubuntu.com-20071014144334-eamc8i0q10gs1aro
Tags: upstream-3.2.5
ImportĀ upstreamĀ versionĀ 3.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0"?>
 
2
<!DOCTYPE hibernate-mapping PUBLIC 
 
3
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
 
4
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 
5
 
 
6
<hibernate-mapping package="org.hibernate.test.cid">
 
7
 
 
8
<!-- 
 
9
 
 
10
  This mapping demonstrates 
 
11
 
 
12
     (1) use of a derived property which performs a
 
13
         subselect against an associated table
 
14
         
 
15
     (2) use of <synchronize/> to ensure that auto-flush
 
16
         works correctly for an entity with a property
 
17
         derived from another table
 
18
         
 
19
     
 
20
-->
 
21
 
 
22
    <class name="Product">
 
23
        <synchronize table="LineItem"/>
 
24
    
 
25
        <id name="productId"
 
26
                length="10">
 
27
                <generator class="assigned"/>
 
28
        </id>
 
29
        
 
30
        <property name="description" 
 
31
                not-null="true" 
 
32
                length="200"/>
 
33
        <property name="price" length="3" column="cost"/>
 
34
        <property name="numberAvailable"/>
 
35
        
 
36
        <property name="numberOrdered"
 
37
                formula="( select sum(li.quantity) from LineItem li where li.productId = productId )"/>
 
38
        </class>
 
39
 
 
40
</hibernate-mapping>