| <?xml version="1.0"?> |
| <document url="http://www.openejb.org/index.xml" toc="none"> |
| <body> |
| <title>OpenEJB -- CMP Guide</title> |
| |
| |
| <section title="Introduction"> |
| <p> |
| OpenEJB uses Castor JDO for CMP persistence. The CMP config files are all |
| Castor controlled files (<a href="http://www.castor.org">www.castor.org</a>). |
| There is no difference between configuring a CMP EntityBean in OpenEJB |
| than with any other Castor controlled java object, so anything you learn |
| about Castor's config files will be applicable. |
| </p> |
| </section> |
| |
| |
| <section title="The basics"> |
| <p>Declare a CMP Container in your openejb.conf for the database that you |
| wish to work with. |
| <ul> |
| <li><a href="config_containers.html">Declaring containers</a></li> |
| </ul> |
| </p> |
| <p>When declaring a new CMP Container to work with a specific database, you |
| need to setup two Castor JDO database files for it. |
| <ul> |
| <li><a href="cmp_dbfiles.xml">Database files</a></li> |
| <li><a href="http://www.castor.org/database-conf.html">File syntax</a></li> |
| </ul> |
| </p> |
| <p>You'll want to make sure you set the 'engine' attribute to the |
| appropriate database name. |
| </p> |
| <p>When deploying an EntityBean, you need to create a Castor JDO mapping file |
| that maps it to the database tables. |
| <ul> |
| <li><a href="http://www.castor.org/jdo-mapping.html">Mapping file syntax</a></li> |
| <li><a href="http://www.castor.org/types.html">Supported data types</a></li> |
| <li><a href="http://www.castor.org/key-generator.html">Handling primary keys</a></li> |
| </ul> |
| </p> |
| <p> The most common mistake with these files is not setting the 'key-generator' |
| attribute to one that works with your database. |
| </p> |
| <p>If your EntityBean has any ejbFind methods, you will need to supply an OQL |
| statement for each find method and put it in your |
| <a href="faq_openejb-jar.html">openejb-jar.xml</a> file. |
| <ul> |
| <li><a href="faq_cmp.html#finders">Mapping finder methods</a></li> |
| <li><a href="http://www.castor.org/oql.html">OQL syntax</a></li> |
| </ul> |
| </p> |
| </section> |
| |
| </body> |
| </document> |