-->
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.  [ 1 post ] 
Author Message
 Post subject: problem with org.hibernate.ce.auction.model.User.java
PostPosted: Tue Jul 05, 2005 3:04 pm 
Newbie

Joined: Mon Jan 03, 2005 7:31 pm
Posts: 4
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: CaveatEmptor 3.1 alpha 1 and dependencies

Mapping documents: N/A

Code between sessionFactory.openSession() and session.close(): N/A

Full stack trace of any exception that occurs:

There is no stack trace, it is an SQL DDL problem.

MySQL 5.0.1 execution


[junit] 13:39:11,766 DEBUG SchemaExport: create table USERS (
[junit] USER_ID bigint not null auto_increment,
[junit] version integer not null,
[junit] firstname varchar(255) not null,
[junit] lastname varchar(255) not null,
[junit] username varchar(16) not null unique,
[junit] 'PASSWORD' varchar(12) not null,
[junit] email varchar(255) not null,
[junit] ranking integer not null,
[junit] IS_ADMIN bit not null,
[junit] created datetime not null,
[junit] street varchar(255),
[junit] zipcode varchar(16),
[junit] city varchar(255),
[junit] DEFAULT_BILLINGDETAILS_ID bigint,
[junit] primary key (USER_ID)
[junit] )
[junit] 13:39:11,781 ERROR SchemaExport: Unsuccessful: create table USERS (USER_ID bigint not null auto_increment, version integer not null, firstname varchar(255) not null, lastname varchar(255) not null, username varchar(16) not null unique, 'PASSWORD' varchar(12) not null, email varchar(255) not null, ranking integer not null, IS_ADMIN bit not null, created datetime not null, street varchar(255), zipcode varchar(16), city varchar(255), DEFAULT_BILLINGDETAILS_ID bigint, primary key (USER_ID))
[junit] 13:39:11,781 ERROR 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 ''PASSWORD' varchar(12) not null, email varchar(255) not null, ranking integer no' at line 1


HSQLDB 1.8.0 execution

[junit] 13:43:22,891 DEBUG SchemaExport: create table USERS (
[junit] USER_ID bigint generated by default as identity (start with 1),
[junit] version integer not null,
[junit] firstname varchar(255) not null,
[junit] lastname varchar(255) not null,
[junit] username varchar(16) not null,
[junit] 'PASSWORD' varchar(12) not null,
[junit] email varchar(255) not null,
[junit] ranking integer not null,
[junit] IS_ADMIN bit not null,
[junit] created timestamp not null,
[junit] street varchar(255),
[junit] zipcode varchar(16),
[junit] city varchar(255),
[junit] DEFAULT_BILLINGDETAILS_ID bigint,
[junit] primary key (USER_ID),
[junit] unique (username)
[junit] )
[junit] 13:43:22,891 ERROR SchemaExport: Unsuccessful: create table USERS (USER_ID bigint generated by default as identity (start with 1), version integer not null, firstname varchar(255) not null, lastname varchar(255) not null, username varchar(16) not null, 'PASSWORD' varchar(12) not null, email varchar(255) not null, ranking integer not null, IS_ADMIN bit not null, created timestamp not null, street varchar(255), zipcode varchar(16), city varchar(255), DEFAULT_BILLINGDETAILS_ID bigint, primary key (USER_ID), unique (username))
[junit] 13:43:22,891 ERROR SchemaExport: Unexpected token: PASSWORD in statement [create table USERS (USER_ID bigint generated by default as identity (start with 1), version integer not null, firstname varchar(255) not null, lastname varchar(255) not null, username varchar(16) not null, 'PASSWORD']



Name and version of the database you are using:
MySQL 5.0.1 & HSQLDB 1.8.0


The generated SQL (show_sql=true): Its a DDL problem see above

Debug level Hibernate log excerpt:


This problem is caused by the apostrophe's that wrap the PASSWORD declaration:

@Column(name = "'PASSWORD'", length = 12, nullable = false)
private String password;

PASSWORD seems to be a reserved word for both HSQLDB - may be a recent change from previous versions and for MySQL at least from 5.0.X on.

Changing the declaration to "\"PASSWORD\"" fixes the problem for both databases:

@Column(name = "\"PASSWORD\"", length = 12, nullable = false)
private String password;


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

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.