I have entities like this which intentionally omit the schema and table names:
@Entity // @Table(name = "V_MBK_KEY") specified in orm.xml public class FeMbkKey implements Serializable { ........ and in orm.xml I add the name and schema: ...... <persistence-unit-metadata> <persistence-unit-defaults> <schema>CLMR</schema> </persistence-unit-defaults> </persistence-unit-metadata> <package>com.ncfbins.services.mship.entity.entities</package> <schema>CLMR</schema> <entity class="FeMbkKey"> <table name="V_MBK_KEY" schema="CLMR" /> </entity> ...... This works fine a lot of the time, resulting in correct queries like SELECT MAX(f.mbkMemberIdNbr) FROM CLMR.V_MBK_KEY f ..... that work fine. However, sometimes it gets into a permanent manner of behavior where it omits the table and schema additions that are in orm.xml; all queries fail in the database because schema and table never got inserted before the query is issued. The final query sent to the database in such cases is omitting the real schema and table name from orm.xml: SELECT MAX(f.mbkMemberIdNbr) FROM FeMbkKey f Of course these fail because there is no FeMbkKey table in the database, just a CLMR.V_MBK_KEY table. The strange thing is that nothing helps now to get it to go back to honoring orm.xml. Yet, I have made essentially no changes from when it worked to when it stopped working. I have stepped through the openjpa source code and it is accessing and parsing orm.xml successfully. Perhaps someone can tell me where would be a couple of places in the source code to set breakpoints to see why it is not translating the entity name into the Query. I have tried using fully-package-qualified class names in orm.xml and that does not help. I have traced through PersistenceMetaDataFactory and other classes and cannot see where it goes wrong. This is all on 0.9.6 final under WebSphere. It occurs on straight openjpa 0.9.6 and also on IBM's packaged alpha update, and on multiple fixpack levels of WebSphere. I think I tried 0.9.7 too. For now, I will have to go back to putting the class and table in the entities but eventually I want to be able to not bind those right into the entities as we have multiple environments to run in... Thanks! Don