-->
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.  [ 10 posts ] 
Author Message
 Post subject: Table 'xxx' doesn't exist
PostPosted: Fri Jun 13, 2008 12:31 pm 
Newbie

Joined: Fri Jun 13, 2008 12:14 pm
Posts: 7
Hi,

i'm new at JPA and this stuff. After working with a tutorial i've got this error. Build it with ANT and Hibernate. Cant really figure out my problem...

3.2 (MyEclipse):

persistence.xml:

MySQL 5.0.51a-3ubuntu5.1:

Code:

[hibernatetool]     alter table ORDERS
[hibernatetool]         drop
[hibernatetool]         foreign key FK8B7256E5B9F34830;
[hibernatetool]     alter table ORDER_DETAIL
[hibernatetool]         drop
[hibernatetool]         foreign key FK4A94AA82D58340C7;
[hibernatetool]     alter table ORDER_DETAIL
[hibernatetool]         drop
[hibernatetool]         foreign key FK4A94AA82342DB10F;
[hibernatetool]     alter table ORDER_INVOICE
[hibernatetool]         drop
[hibernatetool]         foreign key FK1FFDF6FC342DB10F;
[hibernatetool]     drop table if exists CUSTOMER;
[hibernatetool]     drop table if exists ORDERS;
[hibernatetool]     drop table if exists ORDER_DETAIL;
[hibernatetool]     drop table if exists ORDER_INVOICE;
[hibernatetool]     drop table if exists PRODUCT;
[hibernatetool]     drop table if exists PRODUCT_SURVEY;
[hibernatetool]     create table CUSTOMER (
[hibernatetool]         CUST_ID bigint not null auto_increment,
[hibernatetool]         FIRST_NAME varchar(50),
[hibernatetool]         LAST_NAME varchar(50) not null,
[hibernatetool]         STREET varchar(255),
[hibernatetool]         primary key (CUST_ID)
[hibernatetool]     );
[hibernatetool]     create table ORDERS (
[hibernatetool]         ORDER_ID bigint not null auto_increment,
[hibernatetool]         CUST_ID bigint,
[hibernatetool]         OREDER_DESC varchar(255),
[hibernatetool]         ORDER_DATE date,
[hibernatetool]         TOTAL_PRICE double precision,
[hibernatetool]         LAST_UPDATED_TIME date,
[hibernatetool]         primary key (ORDER_ID)
[hibernatetool]     );
[hibernatetool]     create table ORDER_DETAIL (
[hibernatetool]         ORDER_ID bigint not null,
[hibernatetool]         PROD_ID bigint not null
[hibernatetool]     );
[hibernatetool]     create table ORDER_INVOICE (
[hibernatetool]         INVOICE_ID bigint not null auto_increment,
[hibernatetool]         AMOUNT_DUE double precision,
[hibernatetool]         DATE_CANCELLED date,
[hibernatetool]         ORDER_ID bigint,
[hibernatetool]         DATE_RAISED date,
[hibernatetool]         DATE_SETTLED date,
[hibernatetool]         LAST_UPDATED_TIME date,
[hibernatetool]         primary key (INVOICE_ID),
[hibernatetool]         unique (ORDER_ID)
[hibernatetool]     );
[hibernatetool]     create table PRODUCT (
[hibernatetool]         PROD_ID bigint not null auto_increment,
[hibernatetool]         REGULAR_PRICE varchar(255),
[hibernatetool]         PROD_DESC varchar(200),
[hibernatetool]         PROD_NAME varchar(50) not null,
[hibernatetool]         LAST_UPDATED_TIME date,
[hibernatetool]         primary key (PROD_ID)
[hibernatetool]     );
[hibernatetool]     create table PRODUCT_SURVEY (
[hibernatetool]         SURVEY_ID bigint not null auto_increment,
[hibernatetool]         PROD_ID bigint not null,
[hibernatetool]         SURVEY_RESULT text not null,
[hibernatetool]         LAST_UPDATED_TIME datetime,
[hibernatetool]         YEAR_OF_SURVEY integer,
[hibernatetool]         primary key (SURVEY_ID)
[hibernatetool]     );
[hibernatetool]     alter table ORDERS
[hibernatetool]         add index FK8B7256E5B9F34830 (CUST_ID),
[hibernatetool]         add constraint FK8B7256E5B9F34830
[hibernatetool]         foreign key (CUST_ID)
[hibernatetool]         references CUSTOMER (CUST_ID);
[hibernatetool]     alter table ORDER_DETAIL
[hibernatetool]         add index FK4A94AA82D58340C7 (PROD_ID),
[hibernatetool]         add constraint FK4A94AA82D58340C7
[hibernatetool]         foreign key (PROD_ID)
[hibernatetool]         references PRODUCT (PROD_ID);
[hibernatetool]     alter table ORDER_DETAIL
[hibernatetool]         add index FK4A94AA82342DB10F (ORDER_ID),
[hibernatetool]         add constraint FK4A94AA82342DB10F
[hibernatetool]         foreign key (ORDER_ID)
[hibernatetool]         references ORDERS (ORDER_ID);
[hibernatetool]     alter table ORDER_INVOICE
[hibernatetool]         add index FK1FFDF6FC342DB10F (ORDER_ID),
[hibernatetool]         add constraint FK1FFDF6FC342DB10F
[hibernatetool]         foreign key (ORDER_ID)
[hibernatetool]         references ORDERS (ORDER_ID);
[hibernatetool] 4 errors occurred while performing <hbm2ddl>.
[color=red][hibernatetool] Error #1: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test2.ORDERS' doesn't exist
[hibernatetool] Error #1: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test2.ORDER_DETAIL' doesn't exist
[hibernatetool] Error #1: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test2.ORDER_DETAIL' doesn't exist
[hibernatetool] Error #1: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test2.ORDER_INVOICE' doesn't exist[/color]
BUILD SUCCESSFUL



Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 13, 2008 1:30 pm 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
I suppose it is not a real error at all. If you specified for the Hibernate tool to DROP the database tables, and this was your first run, then the tables don't exist. But this doesn't matter: Hibernate schemaexport will create the tables anyway. Just have a look into your database.

Carlo

_________________
Carlo
-----------------------------------------------------------
please don't forget to rate if this post helped you


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 15, 2008 10:46 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
When you look in the database, are the tables there, or are they not there? That seems to be the problem.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 15, 2008 12:57 pm 
Newbie

Joined: Fri Jun 13, 2008 12:14 pm
Posts: 7
Hi,

jep, they are at the db. So i don't have to worry???


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 16, 2008 2:31 am 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
millstone wrote:
Hi,

jep, they are at the db. So i don't have to worry???


No, you needn't. Look at the DDL Hibernate SchemaExport creates and - after creation - executes, i.e.:
Code:
alter table dpjw.USR_PREFS
        drop
        foreign key FK_USERPREF_ID;

    drop table if exists dpjw.ADDRESS;


So, if your database is empty or does not contain one these elements, an error is reported on the console. But this does not have the effect to be an error for SchemaExport. The tool just continues doing it's job.

_________________
Carlo
-----------------------------------------------------------
please don't forget to rate if this post helped you


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 18, 2008 4:58 am 
Newbie

Joined: Fri Jun 13, 2008 12:14 pm
Posts: 7
Hi,

changed MySQL settings at "my.ini" from MyISAM to INNODB

Code:
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB


Why INNODB, read this:
http://dev.mysql.com/doc/refman/5.0/en/innodb-overview.html

ca


Last edited by millstone on Wed Jun 18, 2008 7:43 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 18, 2008 4:59 am 
Newbie

Joined: Fri Jun 13, 2008 12:14 pm
Posts: 7
Hi,

changed MySQL settings at "my.ini" from MyISAM to INNODB

Code:
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB


Why INNODB, read this:
http://dev.mysql.com/doc/refman/5.0/en/innodb-overview.html

ca


Last edited by millstone on Wed Jun 18, 2008 7:43 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 18, 2008 5:59 am 
Newbie

Joined: Fri Jun 13, 2008 12:14 pm
Posts: 7
Hi again...

hmmm, this time I tried another test and *bam* the errors came back...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 18, 2008 6:37 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
MySQL has some weird managing of "schema", try changing hibernate.default_schema
in your configuration to "test2".

Quote:
Changed MySQL settings at "my.ini" from MyISAM to INNODB

Did you hange hibernate.dialect as well?

Also you should try dropping and re-creating your DB.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: (solved)
PostPosted: Wed Jun 18, 2008 7:40 am 
Newbie

Joined: Fri Jun 13, 2008 12:14 pm
Posts: 7
Hi again...

ok, this error just appears at the first generation of the db-tables. If i run it twice, the error is gone.

So it's like "carlolf" said...

THX to all!!!


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