随笔分类 - Hibernate
摘要:本文转自:http://radiumwong.iteye.com/blog/358585Hibernate Tools可以通过访问已经建立好的数据库以反向工程方式生成POJO文件。今天就来说一下如何使用Hibernate Tools来生成POJO。1、首先,要去Hibernate的网站下载这个工具包...
阅读全文
摘要:声明:本文转载自 http://developer.51cto.com/art/200906/128067.htmHibernate Tools for Eclipse Plugins 的安装和使用,这段时间事情比较多一直没有写博客,现在事情忙完了,公司的书柜里有一堆关于Hibernate、Struts和Spring的书,翻了翻发现书中的内容基本上都过时,我喜欢从官方网站上看资料学习最新的技术,这次是我阅读了Hibernate Tools的官方Documents后根据自己的实践总结的。安装Hibernate插件http://download.jboss.org/jbosstools/updat
阅读全文
摘要:(声明)本文转自:http://linjia880714.iteye.com/blog/859334hibernate-tools详细使用教程使用hibernate-tool的版本是hibernatetools-Update-2010-09-08_14-25-39-H231.在eclipse下安装好hibernate-tool插件,新建一个hibernate.cxf.xml文件2.写好数据库连接配置3.4.5.6.7.8.9.10.11.12.最大的方框选择生成的文件类型,下面是生成entity13.14.下图生成的entity有注释是因为使用的模板不是hibernate-tools提供的,是
阅读全文
摘要:Hibernate写入Oracle数据库时,数据库设计字段为Date类型时,只能保存年月日,不能保存时分秒,如果要保存时分秒,需修改Hibernate.cfg.xml文件 将ype="date"修改为上面蓝色部分即type="timestamp"。
阅读全文
摘要:Hibernate3使用?占位符:Session session = sessionFactory.getCurrentSession();session.beginTransaction();//?占位符使用String sql = "update User t set t.username = ? where t.id = ?";Query query = session.createQuery(sql);query.setString(0, "hel");query.setInteger(1, 22);int result = query.exec
阅读全文
摘要:来源(转载):http://blog.csdn.net/woshisap/article/details/70244821:getCurrentSession会把Session和当前的线程关联起来,而openSession只是重新开启一个Session2:getCurrentSession获得的Session会在事务关闭或者回滚时会自动关闭,而openSession获得的Session必须手动关闭 getCurrentSession,特定的实现用它来负责跟踪当前的上下文session,Hibernate内置了此接口的两种实现 * org.hibernate.context.JTASession
阅读全文
摘要:private static SessionFactory sessionFactory = null;static{Configuration configuration =new Configuration(); configuration.configure(); ServiceRegistry serviceRegistry =new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry(); sessionFactory = configuration.b.
阅读全文

浙公网安备 33010602011771号