Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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