×

Loading...

Here you go...

Whether you use single-fielded or multi-fielded primary key id determined by your business data.

Wrapper classes (Integer, Boolean...) cannot be used as primary key because their sole instance variable is PRIVATE. (Wrapper classes follow the immutable pattern.) The instance variables of a primary key must be PUBLIC so that the EJB container can access them directly.
To say, you have a primary class as follows:

public class PK implements java.io.Serializable{

public PK(id) {
this.id=id;
}
public int id;
}

You should be abale to write the following code:

PK pk= new PK(4);
pk.id=123;

Note the syntax above that directly accesses id.
Report