iBatis DAO with Web Services Wizard - Teradata Studio

Teradata Studio IDE Plug-in User Guide

Product
Teradata Studio
Release Number
15.11
Published
May 2016
Language
English (United States)
Last Update
2018-05-03
dita:mapPath
xjy1467322272664.ditamap
dita:ditavalPath
ft:empty
dita:id
B035-2043
lifecycle
previous
Product Category
Teradata Tools and Utilities

The iBatis DAO with Web Services Wizard uses an XML Map file created by the iBatis SQL Map Wizard to implement a Spring Data Access Object (DAO) class. The wizard also gives you the options for the creation of a unit test, WSDL file, and Web service. These are all derived from the iBatis Map file and used with the generated DAO class.

Install Server

The iBatis DAO with Web Services Wizard requires WTP 3.1.2 or WTP 3.2.0. An application server must be installed in Eclipse. Open the Web perspective in Eclipse and go to the Servers view. Right-click in the view and select New > Server.
Select the Apache Tomcat v5.5 Server in the New Server Wizard.
Install the new Apache Tomcat server if required. Follow all installation instructions from Apache and Eclipse.

Create Teradata Project

The iBatis DAO with Web Services Wizard requires a Teradata Project. First make sure you have set all of your Preferences for the Teradata Project before you begin. Select File > New > Other.. from the top menu bar in Eclipse. Next select the Teradata Wizards > Teradata Project from the pop-up dialog. Enter "Sample" for the name of your new Project in the Teradata Project Wizard and click Finish. The wizard creates a Teradata Project.

Create an iBatis SQL Map

The iBatis DAO with Web Services Wizard uses an iBatis SQL Map file to create a DAO and Web Service. Enter the following queries in the SQL Editor in Eclipse. Use the iBatis SQL Map Wizard to create a XML Map for the queries below.
  1. Call the Map file EmployeeMap.
  2. Name the SQL Mapping for the following SQL statement findAll.

    SELECT * FROM employee;

  3. Name the next SQL Statement mapping findByEmpNo.

    SELECT FROM employee EmpNo WHERE EmpNo = ?;

  4. Name the next SQL Statement mapping insert.

    INSERT INTO "guest"."Employee" ("EmpNo", "Name", "DeptNo", "JobTitle", "Sex", "EdLev") VALUES(? , ?, ?, ?, ?, ?); The Last SQL mapping should be called "update" UPDATE "guest"."Employee" SET "Name"=?, "DeptNo"=?, "JobTitle"=?, "Sex"=?, "EdLev"=? WHERE "EmpNo"=?;

Launching the Wizard

After you create the EmployeeMap, launch the iBatis DAO Web Services Wizard by right-clicking the EmployeeMap.xml file from the Package Explorer and selecting Create a DAO.

iBatis DAO with Web Services Wizard

The first screen of the wizard defines the new DAO and options to create a Web Service.
  1. Select the following options:
    • Create WSDL
    • Create Web Service
    • Save Password
  2. Click Next.

iBatis DAO Methods

The iBatis DAO Methods Wizard allows you to select which SQL actions from your iBatis Map file to use in your Web Service. You can change your return result set object to return a list of result set objects instead. After you click Next, your DAO and Web Service Definition files are created.

Web Service Creation

The standard WTP Web Services Wizard sets your Web Service client to test. After you click Finish, your Stubs and Skeletons are created for your Web Service. The Implementation stub is modified to use the new DAO you just created.

Web Service

The Web Service client comes up ready to use and connected to your Teradata Database. You can now continue to develop your Web Service application.