Skip to content

spertch9a/Jcolibri-Travel-recommend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jcolibri Travel recommend

/**

  • 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">
    • &lt;id name="id" column="caseId"&gt;&lt/id&gt;
      
    • &lt;property name="price" column="Price"/&gt;
      
    • &lt;property name="hotel" column="Hotel"/&gt;	
      
    • </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

*/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages