Procházet zdrojové kódy

Remapped HandlingActivity to use its own table

peter_backlund před 16 roky
rodič
revize
aed6e75d13

+ 1
- 0
dddsample/tracking/core/src/main/resources/hibernate.cfg.xml Zobrazit soubor

@@ -18,6 +18,7 @@
18 18
     <mapping resource="se/citerus/dddsample/tracking/core/infrastructure/persistence/hibernate/Location.hbm.xml" />
19 19
     <mapping resource="se/citerus/dddsample/tracking/core/infrastructure/persistence/hibernate/CarrierMovement.hbm.xml" />
20 20
     <mapping resource="se/citerus/dddsample/tracking/core/infrastructure/persistence/hibernate/HandlingEvent.hbm.xml" />
21
+    <mapping resource="se/citerus/dddsample/tracking/core/infrastructure/persistence/hibernate/HandlingActivity.hbm.xml" />
21 22
   </session-factory>
22 23
 
23 24
 </hibernate-configuration>

+ 5
- 21
dddsample/tracking/core/src/main/resources/se/citerus/dddsample/tracking/core/infrastructure/persistence/hibernate/Cargo.hbm.xml Zobrazit soubor

@@ -15,27 +15,11 @@
15 15
       <property name="id" column="tracking_id"/>
16 16
     </component>
17 17
 
18
-    <component name="delivery" lazy="true">
18
+    <component name="delivery">
19 19
       <property name="routedAfterHandling" column="routed_after_handling" not-null="true"/>
20
-      <property name="lastUpdatedOn" column="last_update"/>
21
-      <component name="mostRecentHandlingActivity">
22
-        <many-to-one name="location" column="most_recent_location_id" foreign-key="most_recent_location_fk" cascade="none"/>
23
-        <property name="type" column="most_recent_handling_event_type">
24
-          <type name="org.hibernate.type.EnumType">
25
-            <param name="enumClass">se.citerus.dddsample.tracking.core.domain.model.handling.HandlingEvent$Type</param>
26
-            <param name="type">12</param><!-- 12 is java.sql.Types.VARCHAR -->
27
-          </type>
28
-        </property>
29
-      </component>
30
-        <component name="mostRecentPhysicalHandlingActivity">
31
-          <many-to-one name="location" column="most_recent_physical_location_id" foreign-key="most_recent_physical_location_fk" cascade="none"/>
32
-          <property name="type" column="most_recent_physical_handling_event_type">
33
-            <type name="org.hibernate.type.EnumType">
34
-              <param name="enumClass">se.citerus.dddsample.tracking.core.domain.model.handling.HandlingEvent$Type</param>
35
-              <param name="type">12</param><!-- 12 is java.sql.Types.VARCHAR -->
36
-            </type>
37
-          </property>
38
-        </component>
20
+      <property name="lastUpdatedOn" column="last_update" not-null="true"/>
21
+      <many-to-one name="mostRecentPhysicalHandlingActivity" column="most_recent_physical_act" not-null="false" update="false" cascade="all"/>
22
+      <many-to-one name="mostRecentHandlingActivity" column="most_recent_act" not-null="false" update="false" cascade="all"/>
39 23
     </component>
40 24
 
41 25
     <component name="routeSpecification">
@@ -52,6 +36,6 @@
52 36
         <one-to-many class="se.citerus.dddsample.tracking.core.domain.model.cargo.Leg"/>
53 37
       </list>
54 38
     </component>
55
-
56 39
   </class>
40
+
57 41
 </hibernate-mapping>

+ 23
- 0
dddsample/tracking/core/src/main/resources/se/citerus/dddsample/tracking/core/infrastructure/persistence/hibernate/HandlingActivity.hbm.xml Zobrazit soubor

@@ -0,0 +1,23 @@
1
+<?xml version="1.0"?>
2
+
3
+<!DOCTYPE hibernate-mapping PUBLIC
4
+  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
5
+  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
6
+
7
+<hibernate-mapping default-access="field">
8
+
9
+  <class name="se.citerus.dddsample.tracking.core.domain.model.shared.HandlingActivity">
10
+      <id name="_primaryKey" column="id">
11
+        <generator class="org.hibernate.id.IdentityGenerator"/>
12
+      </id>
13
+      <many-to-one name="location" column="location_id" foreign-key="location_fk" cascade="none" update="false" fetch="join"/>
14
+      <property name="type" column="handling_event_type" update="false">
15
+        <type name="org.hibernate.type.EnumType">
16
+          <param name="enumClass">se.citerus.dddsample.tracking.core.domain.model.handling.HandlingEvent$Type</param>
17
+          <param name="type">12</param><!-- 12 is java.sql.Types.VARCHAR -->
18
+        </type>
19
+      </property>
20
+      <many-to-one name="voyage" column="voyage_id" foreign-key="voyage_fk" not-null="false" cascade="none" update="false" fetch="join"/>
21
+  </class>
22
+
23
+</hibernate-mapping>

+ 1
- 11
dddsample/tracking/core/src/main/resources/se/citerus/dddsample/tracking/core/infrastructure/persistence/hibernate/HandlingEvent.hbm.xml Zobrazit soubor

@@ -18,16 +18,6 @@
18 18
     <component name="operatorCode" update="false">
19 19
       <property name="code" column="operator_code" not-null="false" length="3"/>
20 20
     </component>
21
-    <component name="activity" update="false">
22
-      <many-to-one name="voyage" column="voyage_id" not-null="false" cascade="none" foreign-key="event_voyage_fk"/>
23
-      <many-to-one name="location" column="location_id" not-null="true" cascade="none" foreign-key="location_fk"/>
24
-      <property name="type" column="type" not-null="true">
25
-        <type name="org.hibernate.type.EnumType">
26
-          <param name="enumClass">se.citerus.dddsample.tracking.core.domain.model.handling.HandlingEvent$Type</param>
27
-          <param name="type">12</param>
28
-          <!-- 12 is java.sql.Types.VARCHAR -->
29
-        </type>
30
-      </property>
31
-    </component>
21
+    <many-to-one name="activity" column="activity_id" foreign-key="activity_fk" not-null="true" update="false" cascade="all"/>
32 22
   </class>
33 23
 </hibernate-mapping>