-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: DB2 problems
PostPosted: Tue Oct 25, 2005 3:52 pm 
Newbie

Joined: Tue Oct 25, 2005 3:39 pm
Posts: 5
Hi to all,

Here is what I have:
Movie-> entity bean mapped to a DB2 database
MovieBean->retrieves the entity bean with name or Id

A have a servlet that gets the bean with the name passed to it.

Here is my problem: I get this error when accessing the method that searches in DB.

java.sql.SQLException: invalid schema name: EON in statement [select movie0_.P_ID as P1_0_, movie0_.P_NAME as P2_0_ from EON.HT_PRODUCT movie0_ where movie0_.P_NAME like ?].

I have 2 projects: One with a JUnit test case to test the ejbs. I have the embeddable ejb3 container in an eclipse environment. Everything is working as expected. I can access the entity bean...

The other projects runs a JBoss AS with the all config. I deploy my war and ejb3 packages. I can access the bean from my servlet.

If I take out the code that checks in the DB, the servlets receives the info?

What is the difference between the 2?? What is the interrogation mark at the end of my ejbql string, isn't it setting the parameter?


Top
 Profile  
 
 Post subject: parameter
PostPosted: Wed Oct 26, 2005 12:19 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
http://www.hibernate.org/hib_docs/v3/re ... on-logging

To see actyal parameter you need to set org.hibernate.type

As for EON: could it be that hibernate.default_schema="EON" in that configuration ?

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 12:52 pm 
Newbie

Joined: Tue Oct 25, 2005 3:39 pm
Posts: 5
Hi,

Thank you for the reply:

EON is the name of the schema in the database. the ht_product is a table in this schema (EON.HT_PRODUCT).

I use the entity annotation this way
@entity (name="HT_PRODUCT", schema="EON")
also tried
@entity(name="EON.HT_PRODUCT") with same result

I'm getting a SQLSTATE error: 3F000, meaning invalid schema. This error in DB2 can occur with the set current schema call. It is the only place that this error appears in DB2 documentation

The problem is that I am using the same user/password to access the DB., so it should not be related to DB configuration or rights to the user. (I'm using admin rights, so this should be ruled out).

Why does this occur only when in JBoss


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 12:58 pm 
Newbie

Joined: Tue Oct 25, 2005 3:39 pm
Posts: 5
Hi,

Thank you for the reply:

EON is the name of the schema in the database. the ht_product is a table in this schema (EON.HT_PRODUCT).

I use the entity annotation this way
@entity (name="HT_PRODUCT", schema="EON")
also tried
@entity(name="EON.HT_PRODUCT") with same result

I'm getting a SQLSTATE error: 3F000, meaning invalid schema. This error in DB2 can occur with the set current schema call. It is the only place that this error appears in DB2 documentation

The problem is that I am using the same user/password to access the DB., so it should not be related to DB configuration or rights to the user. (I'm using admin rights, so this should be ruled out).

Why does this occur only when in JBoss


Top
 Profile  
 
 Post subject: ommit schema
PostPosted: Wed Oct 26, 2005 12:59 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Did you try to ommit schema definition entirely and try within JBoss?
i.e.
@entity(name="HT_PRODUCT")

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 26, 2005 1:11 pm 
Newbie

Joined: Tue Oct 25, 2005 3:39 pm
Posts: 5
I got this
Caused by: java.sql.SQLException: Table not found in statement [select movie0_.P_ID as P1_4_, movie0_.P_NAME as P2_4_ from HT_PRODUCT movie0_ where movie0_.P_NAME like ?]

In DB2, if you don't supply a schema, it will use the user name. For instance, if the user is dbadmin, it will use dbadmin.ht_product if I don't supply the name of the schema. It seems that this is not the case when using hibernate.

I must add that I am getting other errors.->
SchemaUpdate] Running hbm2ddl schema update
13:05:47,947 INFO [SchemaUpdate] fetching database metadata
13:05:47,947 ERROR [SchemaUpdate] could not get database metadata
java.sql.SQLException: invalid schema name: SYSIBM in statement [select seqname from sysibm.syssequences]

I seem to have a lot of problems with schemas!!!

Any hint on this will be appreciated

thank you


Top
 Profile  
 
 Post subject: schemas
PostPosted: Wed Oct 26, 2005 1:23 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Hibernate tries to get database schema from schema SYSIBM to compare it with mapping files and generate necessary adjustments (create or alter tables and sequences ).

>> For instance, if the user is dbadmin, it will use dbadmin.ht_product

Unless H configuration specifies hibernate.default_schema=something
and/or hibernate.default_catalog=something in the H configuration

http://www.hibernate.org/hib_docs/v3/re ... n-optional

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 27, 2005 11:07 am 
Newbie

Joined: Tue Oct 25, 2005 3:39 pm
Posts: 5
I don't have any mapping files since I'm using EJB 3.0.

If not define in the persistance.xml, where can I found those configuration files?

I don't have the hibernate config file.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.