12.11.2014 Views

web server - Borland Technical Publications

web server - Borland Technical Publications

web server - Borland Technical Publications

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Implementing an entity bean<br />

Generating primary keys from a custom class<br />

To generate primary keys from a custom class, you must write a class that implements<br />

the com.borland.ejb.pm.PrimaryKeyGenerationListener interface.<br />

Support for composite keys<br />

Primary keys are not restricted to a single column. Sometimes, a primary key is<br />

composed of more than one column. In a more realistic example, a course is not<br />

identified merely by its name. Instead, the primary key for each course record can be<br />

the department in which the course is offered and the course number itself. The<br />

department code and the course number are separate columns in the Course table. A<br />

select statement that retrieves a particular course, or all courses in which a student is<br />

enrolled, must use the entire primary key; that is, it must consider both columns of the<br />

primary key.<br />

The <strong>Borland</strong> CMP engine supports composite primary keys. You can use keys with<br />

multiple columns in the where clause of a select statement. You can also select all<br />

fields of a compound key in the select clause portion of the statement.<br />

For the where clause, specify multiple field names in the same manner that you specify<br />

single field names. Use “and” to separate each field. The format is<br />

= :[ejb/]<br />

Note that the equal (=) sign is one of several possible notations. You could also specify<br />

greater than (>), less than (=), or less than or equal (

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!