After a few days of refactoring the Castor CMP container (I love test first development), I have a CMP container that supports both Castor and OpenJPA. The new default CMP engine is OpenJPA and the configuration is slightly different. The JPA mapping file placed at META-INF/jpa.mapping.xml (name may change), and is a standard JPA entity-mappings.xml file. Alternatively, you should be able to use JPA annotations to specify the mappings. An example jpa.mapping.xml file can be found here:

http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/ openejb-itests-beans/src/main/resources/META-INF/jpa.mapping.xml? view=markup&pathrev=482779


One additional change is caused by OpenJPA requiring that entity beans be bytecode enhanced. We currently do not support runtime enhancement, so you will have to enhance at build time. You can find an example Maven pom that does build time enhancement here:

http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/itests/ openejb-itests-beans/pom.xml?view=markup&pathrev=482779


Other than that, your CMP 1.x beans should just work and you have the additional power of JPA including JPA managed relationships.

If you have any problems, let me know. Now I'm going to work on CMP 2.x support :)

-dain

Reply via email to