Pergunta

I'm using Oracle DB as RDBMS, and I want to access, via my JSF2 application, to two database schema.

So, I think I must use two <persistence-unit> in my persistence.xml ?

Foi útil?

Solução

If accessing two database schemas means just that some of the entities should be in different schema, that can be easily done with Table annotation:

@Entity
@Table(schema="someotherschemathandefault")
public class EntityInOtherSchema {
...
}

If those schemas need different credentials to access (or different datasources to be used), then defining two persistence units is way to go.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top