Dali, Toplink (GlassFish) and DB2 [message #433725] |
Sat, 15 April 2006 17:02  |
Eclipse User |
|
|
|
Hi!
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
using GlassFish/Toplink.
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.
Any ideas?
Thanks, Gunnar
--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
|
|
|
|
|
Re: Dali, Toplink (GlassFish) and DB2 [message #582984 is a reply to message #433725] |
Tue, 18 April 2006 11:29  |
Eclipse User |
|
|
|
In EJB 3.0/JPA you can qualify the schema of an entity with the @Table
annotation. For example if you have:
@Table(schema="foo")
public class Address {
// various mappings
...
}
and you have the query:
select a from Address a
with TopLink Essentials I get:
SELECT ADDRESS_ID, COUNTRY, STREET, P_CODE, CITY, PROVINCE FROM
foo.ADDRESS
Hope that helps,
Shaun
P.S. You can post TopLink Essentials questions on the TopLink forum on the
Oracle Technology Network:
http://forums.oracle.com/forums/forum.jspa?forumID=48
|
|
|
|
Powered by
FUDForum. Page generated in 0.04072 seconds