-->
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: Using reserved words as column names (like length, year)
PostPosted: Wed Dec 13, 2006 6:52 am 
Beginner
Beginner

Joined: Mon Mar 20, 2006 7:59 am
Posts: 30
Hello,

I am using the latest version of Hibernate with a Firebird SQL database. I am using the EJB3-Annotations style of coding. I have got a class "Article" that has a field "length". It looks like that:
Code:
@Entity
@Table(name = "Articles")
public class Article implements Serializable {

   private static final long serialVersionUID = 2511213307378988331L;

   @Id
   @GeneratedValue(strategy = GenerationType.AUTO)
   protected Long id;

   private int length;

   public Long getId() {
      return id;
   }

   public int getLength() {
      return this.length;
   }

   public void setLength(int length) {
      this.length = length;
   }
}

I've set the configuration attribute "hibernate.hbm2ddl.auto" to "create" for testing. Every entity table gets created automatically except of the articles table. When I add
Code:
@Column(name = "`length`")
to the length field, everything seems to work. But then the only column in lower case is the length column. I would like to avoid this and let hibernate do everything.

Is this a bug or a feature and what am I supposed to do?

Regards and thanks for responses,
Sir-Archimedes


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.