This topic is a little bit off-topic but I hope to get an answer from
the Dali/Toplink people here. ;)
I'm using Dali and generated some entities from existing tables. It's a
DB2 database. The problem is that I don't know how to set the DB2 schema
at runtime. When creating the connection in Eclipse Dali allowed to to
select a database schema (other than the default that belongs to the
user). However, I'm not aware of such an option in the persistence.xml
The problem is probably because DB2 uses the user's schema as the
default schema. However the entity exists in a different schema on the
same db. Thus, a simple "select object(o) from Entity o" fails because
GlassFish is using the wrong schema.
I know that there is a property in Hibernate "hibernate.default_schema".
But I haven't found something similar in GlassFish.
The standard JPA solution to setting a default schema for your persistence unit is to configure the schema setting in the persistence-unit-defaults. This is defined in 1 and only 1 XML Mapping file (orm.xml) as follows: