SSH时如何获得各个表的结构信息,借助SessionFactory? 两张表t_tblInfo,t_colInfo,能在Tomcat启动时,将DB的表信息插入数据库(那两张表的表)?

解决方案 »

  1.   

    ????没有看懂!import org.hibernate.cfg.Configuration;
    import org.hibernate.tool.hbm2ddl.SchemaExport;public class ExportDB { public static void main(String[] args) {

    //读取hibernate.cfg.xml文件
    Configuration cfg = new Configuration().configure();

    SchemaExport export = new SchemaExport(cfg);

    export.create(true, true);
    }
    }
      

  2.   

    在hbm.xml中配置了表,还要知道表结构是啥意思呢?
    tmocat启动时执行一个servlet
    将输入插入表中
      

  3.   

    hibernate是一个orm框架,对于开发者来说,数据库可以变得透明,只要关心实体类就行了,
    但我们往往忽略了这点...总是以数据库为准..
      

  4.   

    既然有spring,在tomcat启动时就可以使用init方法来启动一个bean来进行操作
      

  5.   

    关注次帖,没听懂楼主要问什么,我认为是看数据源的配置。然后就是hibernate配置文件