-->
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.  [ 2 posts ] 
Author Message
 Post subject: Creating tables that use sql keywords?
PostPosted: Mon Oct 23, 2006 10:10 am 
Beginner
Beginner

Joined: Sat Aug 19, 2006 8:04 pm
Posts: 30
Hi,

The forum search is broken and has been for a long time. Someone needs to get on that, everytime I have a question I have to make a thread since I can't go to page 2 on the search! I know this has been covered before but I've got to ask it again.

I have a simple entity class like this:

Code:
@Entity
public class User  {
    @Id @GeneratedValue(strategy=GenerationType.auto)
    private Short id;

    private Short order;
   
    // other properties & getters / setters
}


creating this table fails because User is an sql keyword and so is order. I know i can specify the sql with @Table & @Column, but I generally prefer to not think sql at all, I like all of that being totally abstracted. I could change the names of these properties but that's even worse.

So I'm wondering if there's a way to tell hibernate to put the table & column names in [ ] ? Really I think this should be a standard feature, if a specific sql is name is unspecified, check to see if it's a keyword, and if so, bracket it.

Does hibernate do that some how? if not it should!!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 7:53 pm 
Beginner
Beginner

Joined: Sat Aug 19, 2006 8:04 pm
Posts: 30
i'm bumping this up because it's still pissing me off.

right now i'm using hibernate tools to generate a data dictionary. the hbm2doc is very nice, especially since i can use my own freemarker templates!!

what i want to do is add a bunch of stuff and use stripes (stripes.m4cj.org it's the best) and store it all in the database using a map. every single thing in my model is an sql keyword ..

Code:
class Database  {
    Map<String, Table> tables;
}

class Table  {
    Map<String, Column> columns;
}

class Column  {
    String description;
    String possibleValues;
    String references;
    String populated;
    .....
}


anyone with me that i should just be able to create those tables using hbm2ddl=auto and it should put [columns] [tables] etc in brackets??


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