Skip to main content

Exercises

  1. If you have not yet done so, use MVIMPORT to import the sample Universe account into Caché. Read Migrating a MultiValue Application for instructions.

  2. If you have not yet done so, run PROTOCLASS on PERSON. Be sure to include all of the dictionary entries in the class.

  3. If you have not yet done so, generate a Java projection for MVFILE.PERSON.

  4. Create a Java method named addPhone that uses Java projections to add “999-888-7777” to the PHONE list for all MVFILE.PERSON records with NAME value “SMITH,...” (that is, with last name SMITH).

    Hint: Use the openByQuery method to retrieve the correct set of MVFILE.PERSON objects. For information on openByQuery, see Executing a Dynamic Query: openByQuery in the Caché Java Binding and JDBC QuickStart Tutorial

  5. Create a Java method named RunRoutine that uses Java projections to execute the SETVALUE.mvb routine. This routine updates the data in a PERSON item. Both the routine and the Caché class that calls it, MVExercise.Update, are stored in MVExercises.xml, which is in <cachesys>\Dev\tutorials\mv.

  6. Create a Java method named addPerson that uses JDBC and not Java projections to insert a new row into MVFILE.PERSON. Please note that the ItemId field is required and its value must be unique. So, your SQL INSERT must provide a unique value for this field.

Note:

The solutions for the exercises are in <cachesys>\Dev\tutorials\mv\ExerciseSolutions.java.

FeedbackOpens in a new tab