This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes alter table command Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "alter table command" Watch "alter table command" New topic

alter table command

Arun R. S. Chandran
Ranch Hand

Joined: Oct 08, 2008
Posts: 81

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

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

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.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Arun R. S. Chandran
Ranch Hand

Joined: Oct 08, 2008
Posts: 81
Thanks Paul
It is sorta covered in the JavaRanch Style Guide.
subject: alter table command
Similar Threads
How to pass Arraylist values from an actionClass to a JSP page
How to insert form-data(.jsp) into MySql through Servlets
WA #1.....word association
what is K&B book-SCJP exam
Clean database