Listing 1: CatalogBean.java

import javax.ejb.*;

abstract public class CatalogBean implements EntityBean {


  private EntityContext ctx;

	public CatalogBean() {};


  public void setEntityContext(EntityContext ctx) {

    this.ctx = ctx;
  }


  public void unsetEntityContext() {
    this.ctx = null;


  }

	abstract public String getCatalogId();
	abstract public void setCatalogId(String catalogId);

	abstract public String getJournal();
	abstract public void setJournal(String journal);

	abstract public String getPublisher();
	abstract public void setPublisher(String publisher);

  public void ejbActivate() {

  }


  public void ejbPassivate() {

  }


  public void ejbLoad() {

  }

  public void ejbStore() {

  }


  public void ejbRemove()
    throws RemoveException
  {

  }


  public String ejbCreate(String catalogId)
    throws CreateException
  {


    setCatalogId(catalogId);


    return null;
  }


  public void ejbPostCreate(String catalogId)
  {

  }



}

Listing 2: Catalog.java

import java.rmi.RemoteException;
import javax.ejb.*;


public interface Catalog extends EJBObject {


  public String getCatalogId()
    throws RemoteException;

  public String getJournal()
    throws RemoteException;

  public String getPublisher()
    throws RemoteException;

   public void setJournal(String journal)
    throws RemoteException;

  public void setPublisher(String publisher)
    throws RemoteException;

}

Listing 3: CatalogHome.java

import javax.ejb.CreateException;
import javax.ejb.EJBHome;
import javax.ejb.FinderException;
import java.rmi.RemoteException;



public interface CatalogHome extends EJBHome {


  public Catalog create(String catalogId)
    throws CreateException, RemoteException;

  public Catalog findByPrimaryKey(String catalogId)
    throws FinderException, RemoteException;



}

Listing 4: ejb-jar.xml

<?xml version="1.0"?>
<!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>
  <enterprise-beans>
    <entity>
      <ejb-name>Catalog</ejb-name>
      <home>com.ejb.CatalogHome</home>
      <remote>com.ejb.Catalog</remote>
      <ejb-class>com.ejb.CatalogBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      <reentrant>False</reentrant>
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>CatalogBean</abstract-schema-name>
      <cmp-field>
        <field-name>catalogId</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>journal</field-name>
      </cmp-field>
      <cmp-field>
        <field-name>publisher</field-name>
      </cmp-field>
      <primkey-field>catalogId</primkey-field>
    </entity>
  </enterprise-beans>
</ejb-jar>

Listing 5: jboss.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
<jboss>
 <enterprise-beans>
  <entity>
   <ejb-name>Catalog</ejb-name>
   <jndi-name>com.ejb.CatalogHome</jndi-name>
  </entity>
 </enterprise-beans>
</jboss>

Listing 6: weblogic-ejb-jar.xslt

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output  method="xml" doctype-public="-//BEA Systems, Inc.//DTD WebLogic 8.1.0
 EJB//EN"  doctype-system="http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd"/>
<xsl:template match="/jboss">
<weblogic-ejb-jar>
<xsl:apply-templates select="enterprise-beans/entity"/>
</weblogic-ejb-jar>
</xsl:template>
<xsl:template match="entity">
<weblogic-enterprise-bean>
    <ejb-name><xsl:value-of select="ejb-name"/></ejb-name>
    <entity-descriptor>
      <persistence>
	<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>
    </entity-descriptor>
    <jndi-name><xsl:value-of select="jndi-name"/></jndi-name>
  </weblogic-enterprise-bean>
</xsl:template>
</xsl:stylesheet>

Listing 7: weblogic-ejb-jar.xml

<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC
"-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN"
"http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd" >
<weblogic-ejb-jar>
  <weblogic-enterprise-bean>
    <ejb-name>Catalog</ejb-name>
    <entity-descriptor>
      <persistence>
	<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>
    </entity-descriptor>
    <jndi-name>com.ejb.CatalogHome</jndi-name>
  </weblogic-enterprise-bean>
</weblogic-ejb-jar>

Listing 8: jbosscmp-jdbc.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN"

"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">
<jbosscmp-jdbc> 
 <defaults>
  <datasource>java:/MySqlDS</datasource>
  <datasource-mapping>mySQL</datasource-mapping>
 </defaults>
 <enterprise-beans>
  <entity>
   <ejb-name>Catalog</ejb-name>
   <create-table>true</create-table>
   <table-name>Catalog</table-name>
   <cmp-field>
    <field-name>catalogId</field-name>
    <column-name>catalogId</column-name>
   </cmp-field>
   <cmp-field>
    <field-name>journal</field-name>
    <column-name>journal</column-name>
   </cmp-field>
   <cmp-field>
    <field-name>publisher</field-name>
    <column-name>publisher</column-name>
   </cmp-field>
  </entity>
 </enterprise-beans>
</jbosscmp-jdbc>

Listing 9: weblogic-cmp-rdbms-jar.xslt

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output  method="xml" doctype-public="-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB
 RDBMS Persistence//EN"
 doctype-system="http://www.bea.com/servers/wls810/dtd/weblogic-rdbms20-persistence-810.dtd"/>
<xsl:template match="/jbosscmp-jdbc">

<weblogic-rdbms-jar>
<xsl:apply-templates select="enterprise-beans/entity"/>
<create-default-dbms-tables>AlterOrCreate</create-default-dbms-tables>
</weblogic-rdbms-jar>
</xsl:template>

<xsl:template match="entity">
<weblogic-rdbms-bean>
    <ejb-name><xsl:value-of select="ejb-name"/></ejb-name>
    <data-source-name><xsl:value-of select="../../defaults/datasource"/></data-source-name>
    <table-map>
      <table-name><xsl:value-of select="table-name"/></table-name>

     <xsl:apply-templates select="cmp-field"/>
</table-map>

  </weblogic-rdbms-bean>


</xsl:template>

<xsl:template match="cmp-field">
<field-map>
        <cmp-field><xsl:value-of select="field-name"/></cmp-field>
        <dbms-column><xsl:value-of select="column-name"/></dbms-column>
      </field-map>
</xsl:template>
</xsl:stylesheet>

Listing 10: weblogic-cmp-rdbms-jar.xml

<?xml version="1.0"?>
<!DOCTYPE weblogic-rdbms-jar PUBLIC 
'-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB RDBMS Persistence//EN'
'http://www.bea.com/servers/wls810/dtd/weblogic-rdbms20-persistence-810.dtd'>
<weblogic-rdbms-jar>
  <weblogic-rdbms-bean>
    <ejb-name>Catalog</ejb-name>
    <data-source-name>java:/MySqlDS</data-source-name>
    <table-map>
      <table-name>Catalog</table-name>
      <field-map>
        <cmp-field>catalogId</cmp-field>
        <dbms-column>catalogId</dbms-column>
      </field-map>
      <field-map>
        <cmp-field>journal</cmp-field>
        <dbms-column>journal</dbms-column>
      </field-map>
      <field-map>
        <cmp-field>publisher</cmp-field>
        <dbms-column>publisher</dbms-column>
      </field-map>
    </table-map>
  </weblogic-rdbms-bean>
  <create-default-dbms-tables>AlterOrCreate</create-default-dbms-tables>
</weblogic-rdbms-jar>