Here I am providing the java code including descriptors content.
Here is the Bean class: package com.entity.customer;
import java.rmi.RemoteException;
import java.util.Date;
import javax.ejb.EJBException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
public abstract class CustomerBean implements EntityBean
{
public EntityContext entityContext;
public Integer ejbCreate(
String firstName, String lastName)
{
this.setFirstName(firstName);
this.setLastName(lastName);
return null;
}
public void ejbPostCreate(String firstName, String lastName)
{
}
public void ejbActivate() throws EJBException, RemoteException
{
}
public void ejbLoad() throws EJBException, RemoteException
{
}
public void ejbPassivate() throws EJBException, RemoteException
{
}
public void ejbRemove() throws RemoveException, EJBException,
RemoteException
{
}
public void ejbStore() throws EJBException, RemoteException
{
}
public void setEntityContext(EntityContext arg0) throws EJBException,
RemoteException
{
this.entityContext = arg0;
}
public void unsetEntityContext() throws EJBException, RemoteException
{
}
public abstract String getLastName();
public abstract void setFirstName(String firstName);
public abstract String getFirstName();
public abstract void setLastName(String lastName);
public abstract Integer getId();
public abstract void setId(Integer key);
public abstract void setDateOfBirth(Date date);
public abstract void setPlaceOfBirth(String place);
public abstract Date getDateOfBirth();
public abstract String getPlaceOfBirth();
}
This one Remote Component interface /**
*
*/
package com.entity.customer;
import java.rmi.RemoteException;
import java.util.Date;
import javax.ejb.EJBObject;
/**
* @author Acer
*
*/
public interface Customer extends EJBObject
{
public String getLastName() throws RemoteException;
public String getFirstName() throws RemoteException;
public void setLastName(String lastName) throws RemoteException;
public void setFirstName(String firstName) throws RemoteException;
public Date getDateOfBirth() throws RemoteException;
public void setDateOfBirth(Date date) throws RemoteException;
public void setPlaceOfBirth(String place) throws RemoteException;
public String getPlaceOfBirth() throws RemoteException;
public void setId(Integer id) throws RemoteException;
public Integer getId() throws RemoteException;
}
This is Home interface /**
*
*/
package com.entity.customer;
import java.rmi.RemoteException;
import java.util.Collection;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
import javax.ejb.FinderException;
/**
* @author Acer
*
*/
public interface CustomerHome extends EJBHome
{
public Customer create(String first, String last) throws CreateException,
RemoteException;
public Customer findByPrimaryKey(Integer key) throws FinderException,
RemoteException;
public Collection findByPlaceOfBirth(String placeOfBirth)
throws FinderException, RemoteException;
}
weblogic-ejb-jar.xml file <?xml version="1.0" encoding="UTF-8"?>
<weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd"> <weblogic-enterprise-bean>
<ejb-name>CustomerBean</ejb-name>
<entity-descriptor>
<entity-cache>
<max-beans-in-cache>1000</max-beans-in-cache>
<max-queries-in-cache>0</max-queries-in-cache>
<idle-timeout-seconds>0</idle-timeout-seconds>
<read-timeout-seconds>600</read-timeout-seconds>
<concurrency-strategy>Database</concurrency-strategy>
<cache-between-transactions>
true
</cache-between-transactions>
</entity-cache>
<persistence>
<delay-updates-until-end-of-tx>
true
</delay-updates-until-end-of-tx>
<finders-load-bean>true</finders-load-bean>
<persistence-use>
<type-identifier>
WebLogic_CMP_RDBMS
</type-identifier>
<type-version>7.0</type-version>
<type-storage>
META-INF/weblogic-cmp-rdbms-jar.xml
</type-storage>
</persistence-use>
</persistence>
<enable-dynamic-queries>true</enable-dynamic-queries>
</entity-descriptor>
<transaction-descriptor>
<trans-timeout-seconds>0</trans-timeout-seconds>
</transaction-descriptor>
<jndi-name>CustomerJNDI</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
ejb-jar.xml file <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<display-name>EJBProject</display-name>
<enterprise-beans>
<entity>
<description>
It tells about Customer Table and it's bean
</description>
<display-name>CUSTOMER BEAN</display-name>
<ejb-name>CustomerBean</ejb-name>
<home>com.entity.customer.CustomerHome</home>
<remote>com.entity.customer.Customer</remote>
<ejb-class>com.entity.customer.CustomerBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CustomerShcema</abstract-schema-name>
<cmp-field>
<field-name>firstName</field-name>
</cmp-field>
<cmp-field>
<field-name>lastName</field-name>
</cmp-field>
<cmp-field>
<field-name>dateOfBirth</field-name>
</cmp-field>
<cmp-field>
<field-name>placeOfBirth</field-name>
</cmp-field>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
<query>
<description>
To Find out the customer using key
</description>
<query-method>
<method-name>findByPrimaryKey</method-name>
<method-params>
<method-param>java.lang.Integer</method-param>
</method-params>
</query-method>
<result-type-mapping>Remote</result-type-mapping>
<ejb-ql>
select OBJECT m FROM CustomerShcema m WHERE m.id =
?1
</ejb-ql>
</query>
<query>
<description>
To Find out the customer using place of birth
</description>
<query-method>
<method-name>findByPlaceOfBirth</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<result-type-mapping>Remote</result-type-mapping>
<ejb-ql>
select OBJECT m FROM CustomerShcema m WHERE
m.placeOfBirth = ?1
</ejb-ql>
</query>
</entity>
</enterprise-beans>
<ejb-client-jar>EJBProjectClient.jar</ejb-client-jar>
</ejb-jar>