문제

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 ?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top