Presented by developerWorks, your source for great tutorials
ibm.com/developerWorks
*
...
*
* @resin ejb.relation
sql column="DEPTID"
*
*
*/
public abstract Dept getDept();
/** @ejb:interface method view type="local" */
public abstract void setDept(Dept dept);
The
resin ejb.relation
tag has a single parameter (sql column) that points the
column involved in the relationship, that is, the foreign key. It assumes that the foreign
key is pointing to the primary key of the other side of the relationship.
Some vendor specific mappings take two parameters the foreign key and the name of
the column in the other table (Dept) that the foreign key points to. To put this in
perspective, let s show the actual SQL DDL for these tables.
CREATE TABLE DEPT (
DEPTID
INT
IDENTITY
PRIMARY KEY,
NAME
VARCHAR (80)
);
CREATE TABLE EMPLOYEE (
EMPID
INT
IDENTITY
PRIMARY KEY,
FNAME
VARCHAR (80),
LNAME
VARCHAR (80),
PHONE
VARCHAR (80),
DEPTID
INT,
CONSTRAINT
DEPTFK FOREIGN KEY (DEPTID)
REFERENCES DEPT (DEPTID)
);
The employee table has a foreign key
DEPTID
that references the department s
primary key
DEPTID
.
XDoclet and EJB technology: Working with Session
beans
Now that you defined some Entity beans let s create a session bean that access the
Enhance J2EE component reuse with XDoclets
Page 41 of 49






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

j2ee web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved