最近在做的东西是用户权限管理这块的东西,一般开发的时候采用的都是先在数据库里建表,然后使用hibernate反向工程根据数据库里面的表生成相应的java类。现在要使用的是方法是,建立一个用户表,一个权限表,然后采用hibernate多对多映射来做,想请教各位大侠采用这样的方法是先建类还是先建表?(我用的是Spring+hibernate做的项目)我参照网上的视频先建类时在读取hibernate配置文件的时候有问题: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("applicationContext.xml");
SchemaExport export = new SchemaExport(cfg);
export.create(true, true);
}
}采用Spring+hibernate的方式就只好读取applicationContext.xml文件了,这么做有问题,想请教正确的方法应该这么做呢?
请各位大侠给点建议,忙了好久了,没忙出个结果来...
多谢各位大侠了。
import org.hibernate.tool.hbm2ddl.SchemaExport;public class ExportDB { public static void main(String[] args) {
//读取hibernate.cfg.xml文件
Configuration cfg = new Configuration().configure("applicationContext.xml");
SchemaExport export = new SchemaExport(cfg);
export.create(true, true);
}
}采用Spring+hibernate的方式就只好读取applicationContext.xml文件了,这么做有问题,想请教正确的方法应该这么做呢?
请各位大侠给点建议,忙了好久了,没忙出个结果来...
多谢各位大侠了。
解决方案 »
- Tomcat崩溃日志
- 求mycelipse开发工具
- 怎么让图片透明?
- BeanPostProcessor配置遇到的问题.
- 急!!!ORACLE数组--JAVA
- 新手请教:weblogic访问SQL SERVER2000中文问题
- 请那位大侠明确的给解释一下struts中logic:iterator中各个参数的意义?如id,name,type....
- servlet得到一个Vector,然后怎么传给JSP呢?在线等,急!!
- 请问如何在输出得XML中去掉不需要得元素
- ArrayList源代码实现->有的用方法System.arraycopy 有的用Arrays.copyOf,为什么,区别在何处??
- TOMCAT集群 java.io.NotSerializableException:org.apache.struts2.dispatcher.StrutsR
- jxl java设置excel单元格中单个字符的颜色《急》
<mapping
resource="com/entity/User.hbm.xml" />
<mapping
不知道你说的是不是这个意思