Previous Topic: Entity Bean JobsNext Topic: HTTP Jobs


Defining Entity Bean Jobs

You can define an Entity Bean (EJBE_JOB) job to create an entity bean, update the property values of an existing entity bean, or remove an entity bean from the database.

Note: To run these jobs, your system requires CA WA Agent for UNIX, Linux, or Windows and CA WA Agent for Application Services.

Required Statements

To define an Entity Bean job, you must specify the following statements:

In addition, if the OPERATIONTYPE is UPDATE, you must also specify the following statements:

If the OPERATIONTYPE is REMOVE, you must also specify the following statements:

Optional Statements

You can specify the following optional statements for an Entity Bean job:

In addition, if the OPERATIONTYPE is CREATE, you can also specify the following statements:

Example: Create an Entity Bean

Suppose that you want to create an entity bean that stores information about a customer such as the customer ID and phone number. The initial context factory supplied by the JNDI service provider is weblogic.jndi.WLInitialContextFactory. The service provider's URL is t3://localhost:7001, where localhost is the domain name of the WebLogic application server and 7001 is the ORB port. When the job runs, the entity bean instance is created.

AGENT APPAGENT
INITIAL_CONTEXT weblogic.jndi.WLInitialContextFactory
LOCATION t3://localhost:7001
BEAN customer
CREATEMETHOD createcustomer
OPERATIONTYPE CREATE
CREATEPARAMETER TYPE(String) VALUE(customerid)
CREATEPARAMETER TYPE(String) VALUE(800-555-0100)

Example: Update an Entity Bean

Suppose that you want to update the phone number for the Acme company to 800-555-0199. The customer entity bean stores the customer ID and phone number. The primary key for the customer is the customer ID. To find the entity bean, the job uses the Acme's customer ID. When the job runs, the Acme company's phone number is changed.

AGENT APPAGENT
INITIAL_CONTEXT weblogic.jndi.WLInitialContextFactory
LOCATION t3://localhost:7001
BEAN customer
OPERATIONTYPE UPDATE
METHOD changephone
FINDERMETHOD acme
FINDERPARAMETER TYPE(String) VALUE(customerid)
MODIFYPARAMETER TYPE(String) VALUE(800-555-0199)

Example: Remove an Entity Bean

Suppose that you want to remove the customer record for the Acme customer. The record is stored in the database by the customer ID. When the job runs, the row in the customer table that corresponds to the Acme customer ID is removed.

AGENT APPAGENT
INITIAL_CONTEXT weblogic.jndi.WLInitialContextFactory
LOCATION t3://localhost:7001
BEAN customer
OPERATIONTYPE REMOVE
FINDERMETHOD acme
FINDERPARAMETER TYPE(String) VALUE(customerid)