Map CMP bean to two tables

Hi,

I have two tables.

Customer table (CustId, Name, Address, StatusId)

CustomerStatusCodes table (StatusID, StatusDesc)

and I have a CMP for Customer.

It has these attributes.

custId,name,address, statusId,statusDesc

How can I map customer CMP to both these tables.

Thanking You,

Chamal.

[350 byte] By [chamalsla] at [2007-10-3 2:50:45]
# 1

In EJB 3.0 (within your Customer CMP):

@ManyToOne

@JoinColumn(name = "status_id",

referencedColumnName = "CUSTOMER_STATUS_CODES.status_id")

public StatusId getStatusId() {

return statusId;

}

Lookup ManyToOne if you want to see more specific examples.

rvflannerya at 2007-7-14 20:39:36 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
rvflannery,Thanks a lot for ur reply. But we don't have EJB 3.0 at the moment.CHamal.
chamalsla at 2007-7-14 20:39:36 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...