C M P 2 . 0
Relationship Declaration
The declaration of relationships in the ejb jar.xml file is complicated and error prone. The
XML used to declared relationships is as inconsistent as Visual Basic syntax. The best way
to configure a relationship is to use a tool, such as
XDoclet
, or cut and paste a working
relationship. The ejb jar.xml declaration of the Organization Gangster relationship follows:
Organization Gangster
org has gangsters
One
OrganizationEJB
memberGangsters
java.util.Set
gangster belongs to org
Many
GangsterEJB
organization
Listing 9 8, The ejb jar.xml Relationship Declaration
After adding the cmr field abstract accessors and declaring the relationship, the relationship
should be functional. For more information on relationships, see Chapter 4 of the JBossCMP
Documentation, or Section 10.3 of the
Enterprise JavaBeans Specification Version 2.0 Final
Release
. The next section discusses the database mapping of the relationship.
Relationship Mapping
Relationships can be mapped using either a foreign key or a separate relation table.
One to one and one to many relationships use the foreign key mapping style by default, and
many to many relationships use only the relation table mapping style. The mapping of a
89
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved