I'm using hibernate inside JBoss with an Oracle datasource. Usually when I do JDBC queries against the datasource it uses the schema as defined in the -ds.xml. But with hibernate I have to add the hibernate.default_schema property in persistence.xml too:
<persistence-unit name="jpaPersistence"> <jta-data-source>java:/MainDS</jta-data-source> ... <properties> <property name="hibernate.default_schema" value="guy" /> ...