Fight With Me!!!

导航

随笔分类 -  Hibernate

上一页 1 2 3 4 5 下一页

Hibernate工作原理及为什么要用?
摘要:原理:1.通过Configuration().configure();读取并解析hibernate.cfg.xml配置文件2.由hibernate.cfg.xml中的<mapping resource="com/xx/User.hbm.xml"/>读取并解析映射信息3.通过config.buildS 阅读全文

posted @ 2016-05-28 16:35 nickTimer

Hibernate中的query.setFirstResult(),query.setMaxResults();
摘要:一、query.scroll()和query.setFirstResult(),query.setMaxResults();这两种方法都可以取到一定范围内的数据,用来数据分页显示。那么两者区别,以及两者的效率如何? 答:1.scroll是用JDBC2.0的可滚动结果集实现;query.setMaxR 阅读全文

posted @ 2016-05-28 16:32 nickTimer

java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.MetadataProvider
摘要:Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider at java.lang.Class.getDeclaredConstructors0(Na 阅读全文

posted @ 2016-05-28 16:05 nickTimer

Hibernate java.lang.NoSuchFieldError: INSTANCE
摘要:在使用hibernate3.6.2是我遇到了一个有趣的错误java.lang.NoSuchFieldError: INSTANCEat org.hibernate.type.BasicTypeRegistry.<init>(BasicTypeRegistry.java:94)at org.hiber 阅读全文

posted @ 2016-05-28 16:02 nickTimer

Spring的annotation用在set方法上 hibernate的annotation用get方法上
摘要:1.Spring的annotation用在set方法上 2.hibernate的annotation用在get方法上 阅读全文

posted @ 2016-05-28 16:00 nickTimer

Hibernate级联操作
摘要:cascade属性的可能值有 all: 所有情况下均进行关联操作,即save-update和delete。 none: 所有情况下均不进行关联操作。这是默认值。 save-update: 在执行save/update/saveOrUpdate时进行关联操作。 delete: 在执行delete 时进 阅读全文

posted @ 2016-05-28 12:08 nickTimer

Hibernate包及相关工具包下载地址
摘要:Hibernate包及相关工具包下载地址: http://prdownloads.sourceforge.net/hibernate/ 这里包含所有hibernate各个版本的包下载,且提供了 Middlegen Hibernate及hibernate-extensions包的下载。这两个包是用于自 阅读全文

posted @ 2016-05-28 12:04 nickTimer

Caused by: java.lang.ClassNotFoundException: javax.persistence.EntityListeners
摘要:Answer: This seems to be caused by Hibernate 3.6. It is now dependent on JPA, so it must have a JPA jar in the class path as well. You can find one in 阅读全文

posted @ 2016-05-28 11:58 nickTimer

Hibernate包及相关工具包下载地址
摘要:Hibernate包及相关工具包下载地址: http://prdownloads.sourceforge.net/hibernate/ 这里包含所有hibernate各个版本的包下载,且提供了 Middlegen Hibernate及hibernate-extensions包的下载。这两个包是用于自 阅读全文

posted @ 2016-03-16 15:56 nickTimer

JPA中的@MappedSuperclass
摘要:说明地址:http://docs.oracle.com/javaee/5/api/javax/persistence/MappedSuperclass.html用来申明一个超类,继承这个类的子类映射时要映射此类中的字段,可以当做是对entity抽取封装的类。如果子类想重写此类的映射信息,可以使用A... 阅读全文

posted @ 2015-06-29 10:20 nickTimer

Hibernate学习笔记之EHCache的配置
摘要:Hibernate默认二级缓存是不启动的,启动二级缓存(以EHCache为例)需要以下步骤:1、添加相关的包:Ehcache.jar和commons-logging.jar,如果hibernate.jar中含有ehcache就不用添加Ehcache.jar,commons-logging.jar是用... 阅读全文

posted @ 2015-05-25 09:34 nickTimer

关于Hibernate中的Configuration
摘要:Hibernate中,关于从Configuration中建立一个SessionFactory常用的可以有两种方法,一种是为Configuration提供hibernate.cfg.xml配置文件,还有一种就是提供hibernate.properties配置文件。1.提供hibernate.cfg.x... 阅读全文

posted @ 2015-05-25 09:33 nickTimer

Hibernate的一级缓存
摘要:Hibernate的一级缓存是由Session提供的,因此它只存在于Session的生命周期中,也就是当Session关闭的时候该Session所管理的一级缓存也会立即被清除。Hibernate的一级缓存是Session所内置的,不能被卸载,也不能进行任何配置。一级缓存采用的是key-value的M... 阅读全文

posted @ 2015-05-25 09:31 nickTimer

Hibernate工作原理
摘要:1.Hibernate是如何连接数据库主要是通过hibernate.cfg.xml配置文件中的配置在这个文件中定义了数据库进行连接所需要的信息,包括JDBC驱动、用户名、密码、数据库方言等,configuration类借助dom4j的XML解析器解析设置环境,然后使用这些环境属性来生成 Sessio... 阅读全文

posted @ 2015-05-24 17:55 nickTimer

org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
摘要:org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml at org.hibernate.cfg.Configuration.doConfigure(Configuration.ja... 阅读全文

posted @ 2015-05-24 16:27 nickTimer

循环中不要放入openSession()
摘要:for(Shop s:list) { System.out.println(s.getName()); String sql="select shopId,sum(ele_bank+ele_card+water_card+water_bank+coal_c... 阅读全文

posted @ 2015-05-21 00:02 nickTimer

java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.MetadataProvider
摘要:Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider at java.lang.Class.getDeclaredConstructors0(Na... 阅读全文

posted @ 2015-05-20 23:46 nickTimer

hibernate lazy=false annotation设置
摘要:工程报错如下:org.hibernate.LazyInitializationException: could not initialize proxy - no Session解决方法:在类的头部加上@org.hibernate.annotations.Proxy(lazy=false)@Enti... 阅读全文

posted @ 2015-05-19 14:01 nickTimer

Hibernate主键生成策略
摘要:Hibernate主键生成策略1、自动增长identity适用于MySQL、DB2、MS SQL Server,采用数据库生成的主键,用于为long、short、int类型生成唯一标识使用SQL Server 和 MySQL 的自增字段,这个方法不能放到 Oracle 中,Oracle 不支持自增字... 阅读全文

posted @ 2015-05-18 08:37 nickTimer

An AnnotationConfiguration instance is required to use
摘要:An AnnotationConfiguration instance is required to use 这个是mapping 标签配置属性问题class 应该 改为 阅读全文

posted @ 2015-05-17 21:29 nickTimer

上一页 1 2 3 4 5 下一页