-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate HQL Issue - Cannot find table
PostPosted: Wed Apr 07, 2004 12:46 pm 
Beginner
Beginner

Joined: Sun Mar 28, 2004 7:18 pm
Posts: 26
When I run my HQL query and look in debug mode, The SQLException that I get says "Table or view does not exist"

Here is my code :

result = sess.find("from com.accidentfund.common.db.hibernate.PolicyDim as policy where policy.policyNumber = ?",
vo.getPolicyNum(),
Hibernate.STRING);

The mapping for PolcyDim.hbm.xml is :

<class
name="com.accidentfund.common.db.hibernate.PolicyDim"
table="POLICY_DIM"
>

<id
name="policyDimKey"
type="long"
column="POLICY_DIM_KEY"
>
<generator class="assigned" />
</id>

<property
name="policyNumber"
type="java.lang.String"
column="POLICY_NUMBER"
not-null="true"
length="8"
/>

......
......

The database that I am connecting to has multiple schemas ? Is this the reason why hibernate cannot find the table ? Is there a way to specify the schema name (do I even need to) ?

Also, pls let me know how I can see the SQL statements that Hibernate generates (I have set show_sql=true in the props file). Should it be printing to the console ? If so, I dont see any SQL in the console...

Thanks,
S


Top
 Profile  
 
 Post subject: Re: Hibernate HQL Issue - Cannot find table
PostPosted: Wed Apr 07, 2004 1:05 pm 
Regular
Regular

Joined: Wed Mar 03, 2004 9:38 am
Posts: 70
suman wrote:
The database that I am connecting to has multiple schemas ?


How do you think that anyone except you will be able to answer that, especially as you don't even mention which database you're using?

Quote:
Is there a way to specify the schema name (do I even need to) ?


Both on the hibernate-mapping and class level, yes. see

http://www.hibernate.org/hib_docs/reference/html/or-mapping.html#or-mapping-s1-2

Quote:
Also, pls let me know how I can see the SQL statements that Hibernate generates (I have set show_sql=true in the props file). Should it be printing to the console ? If so, I dont see any SQL in the console...


Yes, it should be printing to the console. Depending on your app server, if any, console output may be redirected to some log file.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 07, 2004 1:07 pm 
Beginner
Beginner

Joined: Sun Mar 28, 2004 7:18 pm
Posts: 26
suman wrote:

The database that I am connecting to has multiple schemas ?


How do you think that anyone except you will be able to answer that, especially as you don't even mention which database you're using?

--- That was a typo...it wasnt meant to be posed as a question but a statement. The database does have multiple schemas.

The database is Oracle by the way.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.