> I'm using OpenEJB 3.1.4. How do I specify a data source for a CMP_ENTITY
> container? The documentation specifies the following:
> <Container id="My MySQL Container" type="CMP_ENTITY">
> PoolSize = 100
> Global_TX_Database = conf/mysql.cmp.global-database.xml
> Local_TX_Database = conf/mysql.cmp.local-database.xml
> Do I need to put the datasource settings in the indicated files? I can find
> no further documentation on the format of mysql.cmp.global-database.xml or
Oh geez, that's really old documentation. Can you point out the page where you found it so we can update it?
- yank the <Container> declaration for CMP and let OpenEJB auto create a CMP container for you.
- In the EJB jar where the cmp beans live, add a META-INF/persistence.xml file like the following.
Internally we adapt CMP beans to JPA. If you use the system property 'openejb.descriptors.output=true' we'll actually print out all the generated persistence and mapping files. Then you can include them in your jar and tweak them if you want.
A couple important notes:
- do not change the persistence-unit name. it must be "cmp" for us to find it.
- only openjpa is supported as the cmp persistence provider. the code is 95% generic but there are a couple hooks we needed that weren't covered in the plain JPA api.
It's been quite a long time since I or anyone worked on it, but there is some undocumented code in there that does allow some mixing of cmp/jpa with the idea being that one could slowly convert a CMP app to JPA. I doubt anyone has the time/motivation to do any coding on it these days, but if that kind of feature is attractive to you I can certainly be as supportive as possible in answering questions, applying patches, and getting you what you need to really dig and make it work for you.