[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3322) Entity will not create
scott duke (JIRA)
noreply at atlassian.com
Sat May 31 20:52:33 EDT 2008
Entity will not create
----------------------
Key: HHH-3322
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3322
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Environment: JBoss4.2.2.GA, MySQL 5.0, Windows XP
Reporter: scott duke
Priority: Trivial
A couple of days ago I was trying to create a new entity called "InFile". I have about 5 other entities which do not have any problem, except for the one called InFile. If I rename the entity to InFile2, the problem doesn't occur. The problem is during the application server startup trying to create the database table in MySQL. When I take the SQL script and run it in the MySQL browser, it gets created. I do not know if this is a hibernate issue or MySQL issue.
I found that "infile" is a reserved word in MySQL 5.0, but if it allows me to create the database table from MySQL browser, shouldn't it allow me to create it when I have it defined as an entity?
Below you will see what the log file created.
2008-05-31 09:05:57,812 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] Running hbm2ddl schema export
2008-05-31 09:05:57,812 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] exporting generated schema to database
2008-05-31 09:05:57,812 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
alter table Address
drop
foreign key FK1ED033D411ACF83E
2008-05-31 09:05:57,968 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
alter table Address
drop
foreign key FK1ED033D4C11DB190
2008-05-31 09:05:58,125 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
alter table UzerRoles
drop
foreign key FK621DB3AB3DA02DB8
2008-05-31 09:05:58,250 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
alter table UzerRoles
drop
foreign key FK621DB3AB11ACF83E
2008-05-31 09:05:58,437 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
drop table if exists Address
2008-05-31 09:05:58,453 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
drop table if exists CityStateZip
2008-05-31 09:05:58,468 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
drop table if exists ImportFile
2008-05-31 09:05:58,468 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
drop table if exists InFile
2008-05-31 09:05:58,484 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport] Unsuccessful: drop table if exists InFile
2008-05-31 09:05:58,484 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'InFile' at line 1
2008-05-31 09:05:58,484 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
drop table if exists InFile2
2008-05-31 09:05:58,484 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
drop table if exists Uzer
2008-05-31 09:05:58,515 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
drop table if exists UzerRole
2008-05-31 09:05:58,531 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
drop table if exists UzerRoles
2008-05-31 09:05:58,578 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
create table Address (
id bigint not null auto_increment,
type varchar(255),
version integer,
addressee1 varchar(255),
addressee2 varchar(255),
address1 varchar(255),
address2 varchar(255),
createdOn datetime,
LastUsedOn datetime,
cityStateZipId bigint not null,
uzerId bigint not null,
primary key (id)
)
2008-05-31 09:05:58,687 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
create table CityStateZip (
id bigint not null auto_increment,
country varchar(255),
version integer,
zipcode varchar(255),
latitude float,
longitude float,
city varchar(255),
province varchar(255),
county varchar(255),
zipclass varchar(255),
primary key (id)
)
2008-05-31 09:05:58,734 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
create table ImportFile (
id bigint not null auto_increment,
name varchar(20),
type integer,
version integer,
status integer,
createdOn datetime,
primary key (id)
)
2008-05-31 09:05:58,812 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
create table InFile (
id bigint not null auto_increment,
name varchar(20),
version integer,
primary key (id)
)
2008-05-31 09:05:58,812 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] Unsuccessful: create table InFile (id bigint not null auto_increment, name varchar(20), version integer, primary key (id))
2008-05-31 09:05:58,812 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'InFile (id bigint not null auto_increment, name varchar(20), version integer, pr' at line 1
2008-05-31 09:05:58,812 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
create table InFile2 (
id bigint not null auto_increment,
name varchar(20),
version integer,
primary key (id)
)
2008-05-31 09:05:58,906 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
create table Uzer (
id bigint not null auto_increment,
name varchar(40),
version integer,
uzername varchar(20),
hashedPassword varchar(255),
company varchar(50),
email varchar(255),
primaryPhone varchar(20),
primaryExt varchar(10),
secondaryPhone varchar(20),
secondaryExt varchar(10),
uzerSince date,
primary key (id)
)
2008-05-31 09:05:58,984 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
create table UzerRole (
id bigint not null auto_increment,
name varchar(20),
version integer,
primary key (id)
)
2008-05-31 09:05:59,281 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
create table UzerRoles (
uzerId bigint not null,
roleId bigint not null
)
2008-05-31 09:05:59,343 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
alter table Address
add index FK1ED033D411ACF83E (uzerId),
add constraint FK1ED033D411ACF83E
foreign key (uzerId)
references Uzer (id)
2008-05-31 09:05:59,468 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
alter table Address
add index FK1ED033D4C11DB190 (cityStateZipId),
add constraint FK1ED033D4C11DB190
foreign key (cityStateZipId)
references CityStateZip (id)
2008-05-31 09:05:59,593 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
alter table UzerRoles
add index FK621DB3AB3DA02DB8 (roleId),
add constraint FK621DB3AB3DA02DB8
foreign key (roleId)
references UzerRole (id)
2008-05-31 09:05:59,765 DEBUG [org.hibernate.tool.hbm2ddl.SchemaExport]
alter table UzerRoles
add index FK621DB3AB11ACF83E (uzerId),
add constraint FK621DB3AB11ACF83E
foreign key (uzerId)
references Uzer (id)
2008-05-31 09:05:59,906 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] Executing import script: /import.sql
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list