I'm programming a web application using weblogic and oracle. the datasource is configured through JNDI, with a restricted database user who can DML into tables, but can't DDL. As you may guess, that user isn't the owner of those tables, but he's granted access.
Let's say he is GUEST_USER
The application is using JPA + EclipseLink, and have lots of entities already defined. I don't want to write in each an every entity class the attribute to change schema. I've tried a SessionCustomizer, with this code.
public class MyCustomizer implements SessionCustomizer{
@Override
public void customize(Session session) throws Exception {
session.executeNonSelectingSQL("ALTER SESSION SET CURRENT_SCHEMA = OWNERS_SCHEMA");
}
}
It seems that there's something uninitiallized, I'm getting a null pointer exception, I'm not even sure if this is the way to change the schema for the connections before they are used. Any samples or ideas?
Thanks in advance for your help!