-->
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: Cannot create table with same name as entity class
PostPosted: Sun Feb 06, 2011 4:08 pm 
Newbie

Joined: Sun Feb 06, 2011 10:26 am
Posts: 2
Hi folks,

I'm using Hibernate as persistence provider within JBoss Application Server 6. Within my project, I've created a class User.java which I've annotated to be an entity. Strangely, when I deploy my project, the mapped table is only created in my database when I add the @table annotation and specified a name which must be different from the entity class simple name.

Here's my entity class :

@Entity
@Table(name="Users")
public class User {
...
}

To summarize :

- No @Table annotation --> no table created in my database
- @Table annotation with no table name specified --> no table created in my database (due to the fact that when no name specified, its default value is the entity class simple name, I guess)
- @Table annotation with name="User" --> no table created in my database
- @Table annotation with name != "User" --> OK

Does someone know why?

Thanks in advance.


Top
 Profile  
 
 Post subject: Re: Cannot create table with same name as entity class
PostPosted: Sun Feb 06, 2011 4:35 pm 
Newbie

Joined: Sun Mar 07, 2010 9:05 am
Posts: 13
"USER" is a SQL keyword (as in "CREATE USER"). The same with "GROUP", for example.


Top
 Profile  
 
 Post subject: Re: Cannot create table with same name as entity class
PostPosted: Sun Feb 06, 2011 7:14 pm 
Newbie

Joined: Sun Feb 06, 2011 10:26 am
Posts: 2
What a dumb ass I am !!! Didn't even figure this out ...

Anyway, thanks a lot


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