3 Replies Latest reply on Jul 6, 2008 4:01 PM by Andrew Serff

    Specifying table schema in orm.xml

    Andrew Serff Newbie

      Hello,

      I'm trying to find a way to configure which schema my tables exist within an oracle database. I have a single entity that was hand generated (i.e. not by hbm, i did generate my tables off the entity).

      So far, I have found that you can specify the schema in the orm.xml, however, I cannot get this to work. I have tried:

       <persistence-unit-metadata>
       <persistence-unit-defaults>
       <schema>myschema</schema>
       </persistence-unit-defaults>
       </persistence-unit-metadata>
      

      and also specifying the schema attribute on the entity-mappings element. Neither seem to have any affect. I do not have anything else in my orm.xml. I have tried specifying my one entity by just doing
      <entity class="my.class.name"/>


      Does anyone have an example of how to do this or have any hints for me? Let me know.

      Is there a better way to do this (i.e. not the orm.xml)? I actually don't think the orm.xml is the best solution because it is packaged up in the ejb-jar. I would rather be able to specify the schema name outside of the application and load it at run time, however this seems impossible because the table name, etc are specified in the classes annotations. Hopefully someone knows a better way...

      Thanks!