Chapter 6. Customizing JAWS

Table of Contents

Introduction
Specifying a datasource
JAWS Options
Telling JAWS about your tables
Declaring finders
Defining a type mapping
Dependant Value Objects [since JBoss 2.4]

Author:Sebastien Alborini <sebastien.alborini@m4x.org>

JBoss 2.2 compliance checked by:Vincent Harcq <vincent.harcq@hubmethods.com>

Introduction

JAWS is the O/R mapper used by JBoss to manage CMP entity beans. JAWS is configured in a file named standardjaws.xml, located in the conf/config-name directory in the JBoss distribution. The default “config-name” is “default”.

This file configures JAWS for all JBoss. You can then extend this configuration on a per-application basis by putting a jaws.xml file in the META-INF directory of your application. Upon deploying your beans, JAWS will first process the standardjaws.xml file, and then the jaws.xml file for your application if provided.Please note that if your are bundling your jar archive into an ear archive for deployment the jaws.xml file still must be put into the META-INF directory of the jar archive.

Here is what you can do with standardjaws.xml / jaws.xml:

  • Specify a datasource and the type-mappings to use with it

  • Set a bunch of options concerning jaws behavior

  • Specify how JAWS should build/use your tables

  • Define finders to access you entity beans

  • Define a type mapping

If you want to know everything about jaws.xml, see the Jaws.xml DTD. The general structure of the jaws.xml can be found here. All parts of this file are optional: you only provide what you need!

Download and install the full source code as explain in the section called “Downloading the Documentation Example Source”

Run "ant cmp-jaws-compile" from the "build/" subdirectory. This will create a ejb jar "documentation-example/build-examples/cmp-jaws/ejb/class.jar". Drop it in the "deploy" directory of your JBoss installation. This example shows all possibilities described in this chapter. You may wqnt to change the files as you read this chapter, simply rebuild in EJB jar and deploy it to see the changes.