Skip Headers

Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Configuring Miscellaneous EJB Options

TopLink provides system properties that you can use to customize the following EJB options:

- Setter Parameter Type Checking

- Unknown Primary Key Class Support

- Single-Object Finder Return Type Checking

## Setter Parameter Type Checking

To make TopLink verify that the parameters to one-to-one and one-to-many relationship setters are of the same type as the corresponding CMR field, set system property `toplink.cts.collection.checkParameters` to a value of `true` (not case sensitive). If the setters are not the same type, then TopLink throws a `java.lang.IllegalArgumentException`.

Note: Setting this property to `true` will affect performance. Use this setting only if necessary.

If you set the property to `false` (the default value), TopLink does not make this verification. In this case, it is up to your application to make sure the parameters are of the correct type.

For more information, see the EJB 2.1 specification, section 10.3.6.

## Unknown Primary Key Class Support

In special situations, you may choose not to specify the primary key class or the primary key fields for an entity bean with container-managed persistence. For example, if the entity bean does not have a natural primary key or you want the deployer to select the primary key fields at deployment time, you may choose to defer primary key type specification.

If this is the case, you must declare the type of the argument of the `findByPrimaryKey` method as `java.lang.Object` and you must also specify the primary key class (`prim-key-class`) in the deployment descriptor (`ejb-jar.xml`) as `java.lang.Object`.

TopLink now provides run-time support for such deferred primary key type specification.

For more information, see the EJB 2.1 specification, section 10.8.3.

## Single-Object Finder Return Type Checking

By setting system property `toplink.cts.checkMultipleRows` to `true`, you can configure TopLink to throw a `javax.ejb.FinderException` if multiple beans are returned from a single-object finder method.For more information, see the EJB 2.1 specification, section 10.5.6.1.