I have some, but the samples are in german. I will link you directly to the ear files containing the orm.xml:
Single Entity bean:
Two entity beans with a one-to-many relation
Two entity beans with a many-to-many relation
Hope this helps
Thanks, Wolfgang, this was very helpful. I'm still having trouble trying to mix annotations and XML. My classes are all annotated with table/column specific information and my ORM.xml file contains my named queries. Unfortunately, it doesn't seem able to compile the named queries unless the table/column information is also contained within the ORM file.
Any help would be appreciated. Otherwise, Wolfgang, thanks for your previous post.
if you mix up annotations and xml, you should not add the attribute
metadata-complete="true"to the entities in orm.xml.
Hope this helps, if not I cannot help you further because I did not mix annotations and xml up to now.
Thanks for the follow-up, Wolfgang. Actually, I tried multiple options. First I completely excluded the entity elements. Then, I explicitly set the metadata-complete to false. When I looked further I discovered that the error wasn't explicitly with the EAR that contained the ORM.xml file. My other projects (different EARs) with their own EJB projects were failing to start with errors pointing back to the single query in my ORM.xml.
As it turns out if, my other EJB projects were picking up the ORM.xml in the first project. The fix: put an empy ORM.xml file in the other EJB projects. I was running for the longest time without any ORM.xml files in any of my projects and having no problems. Once I included an ORM.xml file in one of my projects, all the other ones that tried to start after that project failed unless they contained an empty ORM.xml file. It seems a bit odd, but it now works.
I hope this makes sense.
The upshot is that you can have an ORM.xml with no "entity" elements and only queries and it seems to work just fine.
Thanks for your help.
this sounds like a bug if orm.xml is picked across EARs.
Maybe you should file it.