Vincent.Chan‘s Blog

常用链接

统计

积分与排名

网站

最新评论

Hibernate学习

  1. 对托管对象的update调用会使其重新持久化。
一、配置篇
1、org.hibernate.cfg.Configuration实例代表程序种Java类型到SQL数据库映射的完整集合。被用来构建不可变的SessionFactory。
  
     1) Configuration cfg = new Configuration().addResource("Item.hbm.xml");
   
     2) //替代方法:使用以下语句Hibernate会在相关目录下找映射文件。
  
      Configuration cfg = new Configuration().addClass(org.hibernate.impl.Item.class);
     3) //也可以直接进行属性设置
      Configuration cfg = new Configuration()
                    .addClass(org.hibernate.impl.Item.class)
                    .setProperty("hibernate.dialect","org.hibernate.dialect.MySQLDialect")
                    .setProperty("hibernate.connection.datasource","java:comp/env/jdbc/test");

posted on 2006-03-28 22:24 Vincent.Chen 阅读(100) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: