Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

JPA (Java Persistence API) Question

  • 17-04-2009 2:40pm
    #1
    Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭


    On the offchance there's a JPA crack here...

    We're using JPA in a Java EE application, using annotations (as opposed to an orm.xml). DB at the back-end is Oracle. JPA Provider is EclipseLink.

    Its all groovy and stuff, except...

    For various reasons, we need to reference tables which are in a schema other than that of the logged-in user.

    There are a number of ways I can see of doing this...

    Oracle-side, I can do one of two things:

    1) I can specify SYNONYMs in the DB, so that I can refer to objects
    without a schema qualification.
    2) I can have an after_logon trigger to SET CURRENT_SCHEMA what I want.

    For various reasons based on how our systems are run, the latter isn't allowed, and the former would involve quite a lot of work.


    Java-side, I also have at least two options:

    1) Add the schema-name to the @Table annotation.
    2) Abandon annotations, and use an orm.xml

    Again, neither of these are grabbing me.

    Can anyone see another option that I'm missing?


Comments

  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    So...just in case anyone else uses JPA...

    in orm.xml, I can set persistence-unit-defaults, including a schema. These are also applied to the annotation-based approach.

    The only "cost" is that it doesn't use the schema in SequenceGenerators, so I had to switch to TableGenerator instead.


Advertisement