Java Reference
In-Depth Information
public CatalogBean(String catalogId) {
this.catalogId = catalogId;
private String catalogId;
private String journal;
@Column(name = "CatalogId", primaryKey = "true")
public String getCatalogId() {
return catalogId;
public void setCatalogId(String catalogId) {
this.catalogId = catalogId;
public void setJournal(String journal) {
this.journal = journal;
public String getJournal() {
return journal;
An EJB 2.x entity bean instance is created with the create() method in the entity
bean home/local home interface. A client for an EJB 2.x entity bean obtains a
reference for the entity bean with JNDI lookup; CatalogLocalHome is the JNDI
name of the CatalogBean entity bean:
InitialContext ctx=new InitialContext();
Object objref=ctx.lookup("CatalogLocalHome");
CatalogLocalHome catalogLocalHome=(CatalogLocalHome)objref;
//Create an instance of Entity bean
CatalogLocal catalogLocal=(CatalogLocal)catalogLocalHome.
To access the getter/setter methods of an entity bean, the remote/local object in EJB
2.x is obtained with the finder methods:
CatalogLocal catalogLocal =
(CatalogLocal) catalogLocalHome.findByPrimaryKey(catalogId);
An entity bean instance is removed with the remove() method:
Search WWH ::

Custom Search