ItEr39S16CUConfiguracionMaquinasItEr35S09: Doing database mapping for DerivedAllocation and related entities
This commit is contained in:
parent
61267926e9
commit
4bf0abb12b
3 changed files with 34 additions and 0 deletions
|
|
@ -38,6 +38,12 @@ public class DerivedDayAssignment extends DayAssignment {
|
|||
derivedAllocation));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for Hibernate. DO NOT USE!
|
||||
*/
|
||||
public DerivedDayAssignment() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private DerivedAllocation allocation;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,10 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
|
@ -241,6 +243,8 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
@NotNull
|
||||
private ResourcesPerDay resourcesPerDay;
|
||||
|
||||
private Set<DerivedAllocation> derivedAllocations = new HashSet<DerivedAllocation>();
|
||||
|
||||
/**
|
||||
* Constructor for hibernate. Do not use!
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@
|
|||
column="ASSIGNMENT_FUNCTION" not-null="false"
|
||||
cascade="all" lazy="false" />
|
||||
|
||||
<set name="derivedAllocations" cascade="all" inverse="true">
|
||||
<key column="RESOURCE_ALLOCATION_ID" />
|
||||
<one-to-many class="DerivedAllocation"/>
|
||||
</set>
|
||||
|
||||
<joined-subclass name="SpecificResourceAllocation" table="specific_resource_allocation">
|
||||
<key column="RESOURCE_ALLOCATION_ID" />
|
||||
|
||||
|
|
@ -78,6 +83,9 @@
|
|||
<many-to-one name="genericResourceAllocation"
|
||||
class="GenericResourceAllocation" column="GENERIC_RESOURCE_ALLOCATION_ID" />
|
||||
</subclass>
|
||||
<subclass name="DerivedDayAssignment" discriminator-value="DERIVED_DAY">
|
||||
<many-to-one name="allocation" column="DERIVED_ALLOCATION_ID"/>
|
||||
</subclass>
|
||||
</class>
|
||||
|
||||
<!-- AssignmentFunction -->
|
||||
|
|
@ -107,4 +115,20 @@
|
|||
|
||||
</class>
|
||||
|
||||
<class name="DerivedAllocation">
|
||||
<id name="id" type="long" access="property" >
|
||||
<generator class="hilo">
|
||||
<param name="max_lo">100</param>
|
||||
</generator>
|
||||
</id>
|
||||
<version name="version" access="property" type="long" />
|
||||
<many-to-one class="ResourceAllocation" column="RESOURCE_ALLOCATION_ID"
|
||||
name="derivedFrom" not-null="true" />
|
||||
<many-to-one class="org.navalplanner.business.resources.entities.MachineWorkersConfigurationUnit"
|
||||
name="configurationUnit" not-null="true"/>
|
||||
<set name="assignments" cascade="all" inverse="true">
|
||||
<key column="DERIVED_ALLOCATION_ID"/>
|
||||
<one-to-many class="DerivedDayAssignment"/>
|
||||
</set>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue