WF_Process—理解

WF_Process—理解

ProcessInstance.hbm.xml:

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

<! DOCTYPE hibernate - mapping PUBLIC
    
" -//Hibernate/Hibernate Mapping DTD 3.0//EN "  
    
" http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd " >

< hibernate - mapping
>
    
< class
        name
= " com.xindeco.workflow.ProcessInstance "
        table
= " WF_PROCESS "
        dynamic
- update = " true "
        dynamic
- insert = " true "
        select
- before - update = " false "
        optimistic
- lock = " version "
    
>

        
< id
            name
= " ID "
            column
= " ID "
            type
= " long "
            length
= " 30 "
        
>
            
< generator  class = " native " >
            
</ generator >
        
</ id >

        
< discriminator
            column
= " bizClass "
            type
= " string "
        
/>
        
        
< property
            name
= " state "
            type
= " java.lang.Integer "
            update
= " true "
            insert
= " true "
            access
= " property "
            column
= " state "
            length
= " 10 "
        
/>
        
        
< many - to - one
            name
= " flow "
            
class = " com.xindeco.workflow.WFFlow "
            cascade
= " none "
            outer
- join = " auto "
            update
= " true "
            insert
= " true "
            access
= " property "
            column
= " flowId "
        
/>

        
< set
            name
= " tasks "
            lazy
= " true "
            inverse
= " true "
            cascade
= " delete "
            sort
= " unsorted "
        
>

              
< key
                  column
= " processId "
              
>
              
</ key >

              
< one - to - many
                  
class = " com.xindeco.workflow.WFTask "
              
/>

        
</ set >

    
</ class >

</ hibernate - mapping >

CollRegPI.hbm.xml:

<? xml version = " 1.0 " ?>
<! DOCTYPE hibernate - mapping PUBLIC
      
" -//Hibernate/Hibernate Mapping DTD 3.0//EN "
          
" http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd " >

< hibernate - mapping  default - access = " field "   >

  
< subclass name = " com.xindeco.business.pojo.wf.CollRegPI "
            discriminator
- value = "2 "
            
extends = " com.xindeco.workflow.ProcessInstance "
            lazy
= " false " >

            
< many - to - one name = " collReg "
                 
class = " com.xindeco.business.pojo.CollReg "
                 column
= " bizId "
                 cascade
= " none " />
</ subclass >
</ hibernate - mapping >

数据库的数据:
     id    flowid    bizId   bizClass   state
  21       2           9          2              0
 22         2         10         2              0
 23         2         11         2              0
 24         2         12         2              0
 25         2         13         2              0
 26         2         14         2              0
 29         2         17         2              0
 30         2         18         2              1
 44         4         1          32             0
 45         4         2           32             1
 46         5          1          33             0
 47         5          2           33             1
 48         5          3           33             0
 50         3          1            3              0
 51         3         1            3              0

如果bizclass=2是同一种类型的class。由         
         < discriminator
            column
= " bizClass "
            type
= " string "
        
/>来表示。

你可能感兴趣的:(WF_Process—理解)