• Post Reply Bookmark Topic Watch Topic
  • New Topic

is it possible to aklter table using hibernate!

 
hani Ibrahim
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear all i want to develop a web page that adding new columns to table dynamically ,and i use hibernate for communication with DB.is that possible and how please
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. You normally create one table at once and use it forever.
Adding columns dynamically just indicates a flaw in your datamodel.

If you for example want to add a new column every day, then you should rather be using a fixed column denoting the day itself.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by hani Ibrahim:
dear all i want to develop a web page that adding new columns to table dynamically ,and i use hibernate for communication with DB.is that possible and how please


Yes. However, its not a smart thing to do (as Bauke suggests). Hibernate allows you to run SQL, which gives you access to DDL. However, you would need to delete/reconfigure/open your SessionFactory everytime you did this.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!