hi Young
For an entity bean, can the primary key be a primitive, say an integer?
It should be an Integer not java primitive int type.An Integer should be returned for two reasons.First CMP 2.0 intoduces Container Mangement Relationships.This is a way letting an
EJB container manage relationships between ENtity beans.When these relationships are used,the container is responsible for generating additional classes to handle them,similar to a container generating implementation classes for your CMP beans.When these classes are generated ,the first is the primary key value on an entiy bean is stored as an JAVA Object (i.e such as java.lang.Integer) ,and not the primitive type int.
If u are using primary key as composite key,a seperate class for the primary key must be specified.The class must be a simple Java calss that imlements the Serializable interface with the attributes that define the composite key for the enity bean.The attribute names and types int he primary key class must match those int the Entity bean,and also must be declared as public in both the bean implementation calss and the primary key class.
The Primary key class must implement the optional Java.lan.Object methods ,such as equals() and hashCode().
So better to use Integer instead of int when dealing with primary keys.
bye
shyam