This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

alter table command

 
Arun R. S. Chandran
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using hibernate. Is there any query we can use for altering a table?
If it is possible please reply me.

-Arun
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not something you should be doing with Hibernate. If you alter a table, you invalidate any object mapped to it.

Hibernate does support dynamically creating and updating scheama at start up. Have a look at the hbm2ddl properity in the configuration docs.

Hibernate also allows you to run native SQL (check the Session class's JavaDocs). But like I said, not a safe thing to do if the table is mapped.
 
Arun R. S. Chandran
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic