Torque Mapping Object


This chapter is composed of :

  1. Introduction
  2. Torque Mapping Object Resources
    1. Source Folder
    2. Package
    3. Schema
    4. Options
      1. Base Prefix
      2. Add GetByNameMethod
      3. Add Intake Retrievable
      4. Add Save Method
      5. Add Timestamp
      6. Complex Object Model
      7. Use Managers
      8. Object is Caching
      9. Generate Deprecated
    5. Finish
  3. Templates

1. Introduction

The purpose of this chapter is to show how to generate Torque Object Model resources.

This wizard will generate :

This wizard needs to use a target Java Project.

EclipseDatabase provides the current embedded Torque Generator Project Documentation.

 

2. Torque Mapping Object Resources

To start the Torque Mapping Object Resources wizard, select :

File->New->Other->Database->Torque Mapping Object Resources

or

Select an object in the Package Explorer View or the Navigator View then right-click and select :

New->Other->Database->Torque Mapping Object Resources

The selection is contextual.

This means that if you select an existing Database Object:

 

 

The wizard will be opened with a selected Database Connection if applicable.

 

Otherwise :

 

 

The wizard will be opened without any selected Database Connection.


 

2.1. Source Folder

 

 

Type in the Java Source Folder text field the targeted Java Source Folder.

The Java Source Folder should exist.

Otherwise use the Browse button :

 

 

Select the appropriate Java Source Folder.

 

2.2. Package

 

 

Type in the Package text field the targeted Java Package.

Otherwise use the Browse button :

 

 

Select the appropriate targeted Java Package.

 

2.3. Schema

 

 

Use the Browse button :

 

 

The Database Schema selector displays the available Database Schema in your current Project.

Select the appropriate Database Schema.

 

2.4. Options

You can set various Torque options.

For further details about Torque options, you will find a detailed page here.

 

2.4.1. Base Prefix

Inherited Database Schema Torque Base Class.

 

2.4.2. Add GetByNameMethod

If checked, Torque adds methods to get database fields by name/position.

 

2.4.3. Add Intake Retrievable

If checked, the data objects will implement Intake's Retrievable interface

 

2.4.4. Add Save Method

If checked, Torque adds tracking code to determine how to save objects.

 

2.4.5. Add Timestamp

If checked, Torque puts time stamps in generated Object Model files.

 

2.4.6. Complex Object Model

If checked, Torque generates data objects with collection support and methods to easily retrieve foreign key relationships.

 

2.4.7. Use Managers

If checked, Torque will generate Manager classes that use JCS for caching. Still considered experimental.

 

2.4.8. Object is Caching

If checked, Torque generates data objects that cache their foreign key relationships.

If this is not desired (because the underlying objects can be manipulated from other code), uncheck this property.

This currently cannot combined with the manager setting from above.

 

2.4.9. Generate Deprecated

If checked, Torque will generate deprecated methods.

 

2.5. Finish

The code generation process will be performed in the targeted Java Source Folder and its designated target package.

 

 

Detailed information will be displayed in the DatabaseConsole window.

 

 

3. Templates

This wizard is Template based.

Below your Plugin Templates or MyTemplates you should see the following directory.

Torque/om

 

 

These templates are Velocity based and use the Torque Model API.

The Torque.properties is provided as a convenience.