Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » Dali, Toplink (GlassFish) and DB2
Dali, Toplink (GlassFish) and DB2 [message #433725] Sat, 15 April 2006 17:02 Go to next message
Gunnar Wagenknecht is currently offline Gunnar Wagenknecht
Messages: 451
Registered: July 2009
Senior Member
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 #433768 is a reply to message #433725] Tue, 18 April 2006 11:29 Go to previous messageGo to next message
Shaun Smith is currently offline Shaun Smith
Messages: 197
Registered: July 2009
Senior Member
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
Re: Dali, Toplink (GlassFish) and DB2 [message #433770 is a reply to message #433768] Tue, 18 April 2006 13:07 Go to previous message
Gunnar Wagenknecht is currently offline Gunnar Wagenknecht
Messages: 451
Registered: July 2009
Senior Member
Shaun Smith wrote:
> In EJB 3.0/JPA you can qualify the schema of an entity with the @Table
> annotation. For example if you have:

I found out that's also possible to configure this with an
META-INF/orm.properties file.

https://glassfish.dev.java.net/issues/show_bug.cgi?id=580

However, hard wiring the schema name is source code is probably not a
good idea in general.

Cu, 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 Go to previous message
Shaun Smith is currently offline Shaun Smith
Messages: 197
Registered: July 2009
Senior Member
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
Re: Dali, Toplink (GlassFish) and DB2 [message #583009 is a reply to message #433768] Tue, 18 April 2006 13:07 Go to previous message
Gunnar Wagenknecht is currently offline Gunnar Wagenknecht
Messages: 451
Registered: July 2009
Senior Member
Shaun Smith wrote:
> In EJB 3.0/JPA you can qualify the schema of an entity with the @Table
> annotation. For example if you have:

I found out that's also possible to configure this with an
META-INF/orm.properties file.

https://glassfish.dev.java.net/issues/show_bug.cgi?id=580

However, hard wiring the schema name is source code is probably not a
good idea in general.

Cu, Gunnar

--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
Previous Topic:NullPointerException when opening DDL wizard.
Next Topic:Latest Dali Milestone build - M1: dali-N-0.5M1-200603170005 problem
Goto Forum:
  


Current Time: Wed Aug 20 06:54:43 EDT 2014

Powered by FUDForum. Page generated in 0.04360 seconds