-->
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: Is it forbidden to name property to 'unique' or is it a bug?
PostPosted: Fri Jun 12, 2009 7:55 am 
Newbie

Joined: Mon Mar 23, 2009 5:56 am
Posts: 6
Hi !

I had named a boolean property in my entity to 'unique'.
I did set 'hibernate.hbm2ddl.auto' property to 'create' but
Hibernate silently did not create a table for this entity.

I tried out setting one property after another to transient and finally it turned out, that if i rename
the property 'unique' to 'unikue' it works fine.

I am using hibernate 3 and hibernate annotations 3.2.1 with postgres 8.2.506

regards

Michael


Top
 Profile  
 
 Post subject: Re: Is it forbidden to name property to 'unique' or is it a bug?
PostPosted: Fri Jun 12, 2009 10:39 am 
Beginner
Beginner

Joined: Tue Aug 26, 2003 2:46 pm
Posts: 45
Location: Saskatoon SK Canada
I'm guessing it is the database that is not allowing you to name a column 'unique'. Try going into postgres directly and attempt to create a table with a column of that name. That will determine where the problem is.

_________________
Maury


Top
 Profile  
 
 Post subject: Re: Is it forbidden to name property to 'unique' or is it a bug?
PostPosted: Fri Jun 12, 2009 10:46 am 
Newbie

Joined: Mon Mar 23, 2009 5:56 am
Posts: 6
Hi !

Thanks for the tipp !

unique is a reserved keyword in postgres, but i can create a column with this name.

SQL of my table looks like this:

Code:
CREATE TABLE typepropertyimpl
(
  id integer NOT NULL,
  "value" character varying(255),
  "key" character varying(255),
  description character varying(255),
  optional boolean NOT NULL,
  fixed boolean NOT NULL,
  unikue boolean NOT NULL,
  type_id bigint,
  "unique" boolean,
  CONSTRAINT typepropertyimpl_pkey PRIMARY KEY (id),
  CONSTRAINT fk6609d5af161736b4 FOREIGN KEY (type_id)
      REFERENCES types (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)


But you see the name is escaped. And by the way: it works too create columns with name 'value' and with the name 'key'. Maybe hibernate developers simply forgot to escape the 'unique' keyword.

regards

Michael


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.