/**
- This example shows how to manage a complete case with solution and execute some adaptation methods.
- Now the case has also a solution bean with a few attributes. That way, the structure of the case is:
- Case
- |
- +- Description
- | |
- | +- caseId
- | +- HollidayType
- | +- Price
- | +- NumberOfPersons
- | +- Region
- | | |
- | | +- regionId
- | | +- regionName
- | | +- NearestCity
- | | +- Airport
- | | +- Currency
- | +- Transportation
- | +- Duration
- | +- Season
- | +- Accomodation
- | +- Hotel
- |
- +- Solution
-
|
-
+- id
-
+- price
-
+- hotel
- Solution is stored in the TravelSolution bean (CaseComponent).
- This bean could be saved into a separate table, but here were are going to show how to use the same table than the description.
- This way, the mapping is:
-
- Description is saved into the travel table.
- Solution is also saved into the travel table (using different columns, of course).
- Region (the compound attribute) of the description is saved into its own table region.
- Following picture shows how attibutes are mapped into the database:
-
- To configure these mapping we must modify or create the following files:
-
- databaseconfig.xml
- In this file we include the solution class namea and its mapping file:
- <SolutionMappingFile>jcolibri/test/test4/TravelSolution.hbm.xml</SolutionMappingFile>
- <SolutionClassName>jcolibri.test.test4.TravelSolution</SolutionClassName>
- TravelSolution.hbm.xml
- This is a simple mapping file for the solution bean:
- <hibernate-mapping default-lazy="false">
- <class name="jcolibri.test.test4.TravelSolution" table="travel">
-
<id name="id" column="caseId"></id>
-
<property name="price" column="Price"/>
-
<property name="hotel" column="Hotel"/>
- </class>
- </hibernate-mapping>
- Doing these changes the connector will manage the new case structure without problems.
-
- This method also shows how to perform a simple adaptation based in the DirectProportion method that
- modifies the value of an attribute of the solution depending on the value in the query and retrieved case of other attribute of the description.
- @author Juan A. Recio-Garcia
- @version 1.0
- @see TravelDescription
- @see Region
- @see jcolibri.test.test5.TravelSolution
- @see jcolibri.method.reuse.NumericDirectProportionMethod
*/