Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Hibernate to look up table metadata?

 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way I can use hibernate to get table metadata? I need to find the max size of a varchar field in the database.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically this isn't the sort of thing the Hibernate developers imagined you would need to do. Hibernate is supposed to be an abstraction layer between you and the mechanics of the database after all. But you can query the catalog directly via a SQL query. There are also classes in the the API to get at meta data (which Hiebrnate tools do to perform DDL). The hbm2ddl tool for example.
 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link. I need it to do string lenght validation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic