最近用hibernate的时候由于数据量过大,需要动态创建表,但hibernate怎么动态配置呢?求各位大虾指点
------解决方案--------------------
首先配置<property name="hibernate.hbm2ddl.auto">create</property>
自己写一个main或者其他测试类 加入如下代码。ok
Configuration conf=new Configuration();
conf.configure("/hibernate.cfg.xml");
SchemaExport dbExport=new SchemaExport(conf);
dbExport.create(true, true);
------解决方案--------------------
如果我没理解错,你是要用hibernate映射动态表名吗?这个不难继承DefaultNamingStrategy实现classToTableName