Laird & Kevin, This bug has been around a while. It is filed under JIRA OPENJPA-400[1]. The typical workaround is to use the openjpa.jdbc.Schema property. It looks like OpenJPA *may* also pick up the value if you define your entities in the orm.xml -- but my memory is cloudy regarding that workaround. Regardless, this is something that needs to be fixed.
-Jeremy [1] https://issues.apache.org/jira/browse/OPENJPA-400 On Tue, Nov 2, 2010 at 5:17 PM, Kevin Sutter <[email protected]> wrote: > Hi Laird, > I agree with you. You should be able to specify a default schema and/or > catalog via the persistence-unit-defaults element of the orm.xml file. I > just looked through our junits, and I don't see any tests for this > particular configuration... I do see other defaults being tested, just not > the schema or the catalog. > > And, although I can see Patrick's viewpoint in your referenced append on > the > use of multiple orm.xml files, the JPA spec also documents it's position on > this situation (section 8.2.1.6.2): > > *If multiple mapping files are specified (possibly including one or more > orm.xml files), the resulting mappings are obtained by combining the > mappings from all of the files. > The result is undefined if multiple mapping files (including any orm.xml > file) referenced within a single > persistence unit contain overlapping mapping information for any given > class. > * > > Basically, you could still shoot yourself in the foot if you're not > careful. But, it is legal to use multiple orm.xml files and we should be > combining the results to the best of our ability. > > My take is that we should be honoring the default schema and catalog > settings, and if we're not, open a JIRA to get this resolved. > > Thanks, > Kevin > > On Tue, Nov 2, 2010 at 2:27 PM, Laird Nelson <[email protected]> wrote: > > > I have a test suite that runs my JPA entities across all the major JPA > > providers. > > > > None of my entities has a schema name in it; I want to keep it that way. > > > > None of my entities are configured in any way other than annotations. > > > > I understand from the JPA specification that if I put in a > > <persistence-unit-defaults> element in my META-INF/orm.xml file, I can > > indicate a default catalog and a default schema to use. > > > > When I do this, indeed my EclipseLink and Hibernate tests pass. > > > > My OpenJPA tests fail. > > > > I then read this: > > > > > http://openjpa.208410.n2.nabble.com/best-way-to-set-default-schema-across-all-entities-td215796.html > > > > I believe this is a misinterpretation of the specification. Is there any > > way to get OpenJPA to honor the persistence-unit-defaults element in the > > orm.xml file and to apply it to entities that are not listed therein? > > > > I am using OpenJPA 2.0.0-beta3 (not 2.0.1, since that has a > > NullPointerException regression in named queries which I previously > > documented). > > > > Best, > > Laird > > >
