Skip to main content


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 21:02 Go to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 486
Registered: July 2009
Location: San Francisco ✈ Germany
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 15:29 Go to previous messageGo to next message
Shaun Smith is currently offline Shaun SmithFriend
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 17:07 Go to previous message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 486
Registered: July 2009
Location: San Francisco ✈ Germany
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 15:29 Go to previous message
Shaun Smith is currently offline Shaun SmithFriend
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 17:07 Go to previous message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 486
Registered: July 2009
Location: San Francisco ✈ Germany
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:persistence.xml management
Next Topic:Dali M2 build now available
Goto Forum:
  


Current Time: Tue Apr 23 06:46:54 GMT 2024

Powered by FUDForum. Page generated in 0.03926 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top