zw7534313
- 浏览: 1236808 次
- 性别:
- 来自: 北京
社区版块
- ( 0)
- ( 21)
- ( 1)
最新评论
-
mike_eclipse:
hashtable是线程不安全的吗?好像是线程安全的吧?
多线程之集合类 -
july01:
推荐用stratoio打印控件,浏览器和系统的兼容性都很好,而 ...
lodop打印控件 -
xingcxb:
经过测试,假的,依旧会出现中文乱码!!!!store方法里面采 ...
java 读写properties文件,不会出现中文乱码 -
tiger20111989:
...
spring注解方式管理事务 -
zw7534313:
...
js 文字上下滚动 无间断循环显示
文章列表
hibernate search
使用过lucene的人都知道,lucene是使用directory这个概念来存储索引文件的,所以在hibernate search中提供了一个初始化、配置化的工厂类directoryprovider来生成相应的directory.
感觉compass的优势在于通用性好,基本上所有的orm和jdbc都支持,hibernate search只支持hibernate和jpa.
- 2010-10-15 10:09
- 浏览 1324
- 分类:企业架构
1.设置里 lazy = "false" 会导致 org.hibernate.lazyinitializationexception: could not initialize proxy - the owning session was closed
"org.hibernate.lazyinitializationexception: could not initialize proxy"延迟抓取出的错,hb3对many-to-one的默认处理是lazy = "proxy",把所有many-to-one,one-to-one都加 ...
- 2010-09-10 15:57
- 浏览 1931
- 分类:企业架构
- 博客分类:
- hibernate3
hibernate数据检索策略:
hibernate的数据检索策略是面向对象的策略,对于不同的数据检索情况,应使用不同的策
略,以提高效率和节省资源。经常使用的是立即检索和延迟检索,预先抓取是同一级别
的策略,因为它们是三选一的策略。用了其中一个则另外两个就都不可用,而且被延迟
加载的对象当最终被加载时,一定是使用立即加载的形式
- 2010-08-09 08:52
- 浏览 1131
- 分类:企业架构
- 博客分类:
- hibernate3
基本值类型:
java基本类型、对应的hibernate映射类型和标准的sql类型
hibernate映射类型
java类型
标准
- 2010-08-09 08:48
- 浏览 1410
- 分类:企业架构
- 博客分类:
- hibernate3
hibernate事务隔离级别:
隔离级别
脏读 (dirty read)
不可重复读 (nonrepeatable read)
幻读 (phantom read)
- 2010-08-09 08:46
- 浏览 6169
- 分类:企业架构
- 博客分类:
- hibernate3
hibernate数据检索策略:hibernate的数据检索策略是面向对象的策略,对于不同的数据检索情况,应使用不同的策略,以提高效率和节省资源。经常使用的是立即检索和延迟检索,预先抓取是同一级别的策略,因为它们是三选一的策略。用了其中一个则另外两个就都不可用,而且被延迟加载的对象当最终被加载时,一定是使用立即加载的形式(指select 语句的形式).
批量检索可以优化立即和延迟加载,它们可以同时用。
(1) 立即检索:立即检索的配置文件标识符为lazy=”false”.对象的属性域、一对一关联对象、多对一关联对象,由于这些被关联的对象是”一”这端,适合立即检索。而一对多和多对一关联对象则不 ...
- 2010-08-06 15:58
- 浏览 1260
- 分类:企业架构
- 博客分类:
- hibernate3
生成model类的serialversionuid:
在命令提示符下:执行serialver 类路径 类名
例如:c:\program files\java\jdk1.6\bin>serialver -classpath e:\workspace\app\bin\ util.test
在序列化时,有几点要注意的: 1:当一个对象被序列化时,只保存对象的非静态成员变量,不能保存任何的成员方法和静态的成员变量。 2:如果一个对象的成员变量是一个对象,那么这个对象的数据成员也会被保存。 3:如果一个可序列化的对象包含对某个不可序列化的对象的引用,那么整 ...
- 2010-06-25 16:36
- 浏览 1041
- 分类:企业架构
(5)tcompanyinfo.java
import java.util.date;import javax.persistence.entity;import javax.persistence.generatedvalue;import javax.persistence.id;import javax.persistence.table;import org.hibernate.annotations.genericgenerator;import org.hibernate.annotations.parameter;
@entity@table(name=" ...
- 2010-06-13 16:53
- 浏览 1944
- 分类:企业架构
- 博客分类:
- hibernate3
hibernatetemplate还提供一种更加灵活的方式来操作数据库,通过这种方式可以完全使用hibernate的操作方式。hibernatetemplate的灵活访问方式是通过如下两个方法完成:
q object execute(hibernatecallback action)
q list execute(hibernatecallback action)
这两个方法都需要一个hibernatecallback的实例,hibernatecallback实例可在任何有效的hibernate数据访问中使用。程序开发者通过hibernatecallback,可以完全使 ...
- 2010-06-13 09:00
- 浏览 1045
- 分类:企业架构
ssh除了xml配置之外,还可以用标注式配置:
(1)spring 与 hibernate annotation配置(entry) http://zw7534313.iteye.com/blog/691546
(2)spring 与 hibernate annotation配置(dao) http://zw7534313.iteye.com/blog/691529
(3)spring注解方式管理事务 http://zw7534313.iteye.com/blog/691398
(4)spring 与 hibernate annotation配置(applicationcont ...
- 2010-06-11 15:19
- 浏览 1321
- 分类:企业架构
- 博客分类:
- hibernate3
http://bigcat.easymorse.com/?p=249
在ejb3.0 规范中 多对一与一对多的双向关系, 多对一(就是@manytoone注解的这端,是多端哦 不要搞混了)这端总是双向关联端的主题(owner)端, 而一对多端的关联注解为 @onetomany(mappedby=" " )其值是:多对一端的属性
实例三: (一对多)
create table "abc"."clazz" ( "id" number(*,0) not null enable, "clas ...
- 2010-03-24 15:19
- 浏览 2012
- 分类:企业架构
http://2625962-163-com.iteye.com/blog/243789
不同的地方:
- 2010-03-24 08:35
- 浏览 1001
- 分类:企业架构
- 博客分类:
- hibernate3
实例二:(主键sequence策略)
import javax.persistence.entity;import javax.persistence.generatedvalue;import javax.persistence.id;
import org.hibernate.annotations.genericgenerator;import org.hibernate.annotations.parameter;
@entitypublic class score {
@id @generatedvalue(generator=&q ...
- 2010-03-23 15:51
- 浏览 1731
- 分类:企业架构
- 博客分类:
- hibernate3
实例一:一个对象的增删改查:
import java.math.bigdecimal;import java.util.date;import javax.persistence.entity;import javax.persistence.id;import org.hibernate.annotations.genericgenerator;
@entitypublic class user2 implements java.io.serializable {
private integer id; private string name; private string se ...
- 2010-03-23 14:55
- 浏览 1914
- 分类:企业架构
- 博客分类:
- hibernate3
错误原因分析:
首先看hql语句:
select pfp.tprofile from tprofileperson pfp left join fetch pfp.tprofile where pfp.tperson.personid = 114
此处我希望加载tprofileperson下的tprofile,而我使用了fetch来立即抓取tprofile,错误就在这里.如果你使用fetch,那么fetch左边的连接对象(拥有者)一定要出现在select后,例如将上面改为select pfp... 这样就会执行正常,因为使用了fetch,hiberna ...
- 2010-03-04 09:57
- 浏览 1892
- 分类:企业架构
- 博客分类:
- hibernate3
首先说一句:是版本的问题!
我写的hql为:
from department as d where d.employees.name='tom';
运行时出现异常:org.hibernate.queryexception: illegal attempt to dereference collection
是因为:在上面的hql语句中,department的关联实体employees是一个集合,而不直接是一个employee实体。
在hibernate3.2.2以前的版本,hibernate会对关联实体自动使用隐式的inner join,
也就是说如下sql语句不会有任何问题 :f ...
- 2010-03-04 09:12
- 浏览 3618
- 分类:企业架构
3.4.5. 查询语言中的替换
你可以使用hibernate.query.substitutions在hibernate中定义新的查询符号. 例如:
hibernate.query.substitutions true=1, false=0
将导致符号true和false在生成的sql中被翻译成整数常量.
2.在hibernate配置文 ...
- 2010-01-29 14:10
- 浏览 1034
- 分类:企业架构
- 博客分类:
- hibernate3
hibernate查出来人部分数据基本上是数组,有的时候需要对象(但是该对象只包含一部分数据,只需要这一部分)
1.query q = session.createquery("select new user(name,pwd) from user"); list = q.list(); tran.commit();
2.query query = getsessionfactory().getcurrentsession().createsqlquery(hql).addscalar("title",hibernate.st ...
- 2010-01-29 10:56
- 浏览 1314
- 分类:企业架构
- 2010-01-28 11:38
- 浏览 1320
- 分类:企业架构
- 博客分类:
- hibernate3
public void createrolepermissionbysql(final string roleid,final string[] permids){ gethibernatetemplate().execute(new hibernatecallback() { public object doinhibernate(session session) throws hibernateexception, sqlexception { ...
- 2009-12-29 13:37
- 浏览 1975
- 分类:企业架构
- 博客分类:
- hibernate3
1.org.hibernate.lazyinitializationexception: could not initialize proxy - the owning session was closed
有关联的类中设置不延迟
- 2009-12-24 12:52
- 浏览 874
- 分类:企业架构
- 博客分类:
- hibernate3
http://www.cnblogs.com/ksyou/archive/2009/04/02/1428045.html
1.一级缓存: session (似乎共用的一个session,但好象又不是)
2.二级缓存: ehcache1.6
二级缓存是缓存实体对象的
开启二级缓存,修改hibernate.cfg.xml文件 true
- 2009-07-23 11:41
- 浏览 1822
- 博客分类:
- hibernate3
使用c3p0的properties样例代码:hibernate.connection.driver_class = org.postgresql.driverhibernate.connection.url = jdbc:postgresql://localhost/mydatabasehibernate.connection.username = myuserhibernate.connection.password = secrethibernate.c3p0.min_size=5hibernate.c3p0.max_size=20hibernate.c3p0.timeout=1800hib ...
- 2009-07-02 09:39
- 浏览 1829
com.mysql.jdbc.communicationsexception: communications link failure due to underlying exception: ??
org.logicalcobwebs.proxool.proxoolexception: parsing failed.??
http://blog.sina.com.cn/s/blog_4a04ce7601009tin.html解决此问题:
org.hibernate.hibernateexception: proxool provider unable to load ...
- 2009-06-26 09:09
- 浏览 2230
版本:proxool 0.9.1
这次配置出问题了,在hibernate.cfg.xml中少个property,如下:
true
加上就好了。
它的配置:
(1)在src下建proxool.xml