组件列表来自
http://wiki.liferay.com/index.php/Liferay_Dependencies
Hibernate[url]http://www.hibernate.org/ [/url]在liferay中作为数据持久层组件,所有persistence包中都使用hibernate。
Liferay中hibernate配置在portal.properties的hibernate段中。
其中hbm文件默认为位置在
META-INF/counter-hbm.xml,META-INF/mail-hbm.xml,META-INF/portal-hbm.xml,META-INF/ext-hbm.xml
特别要注意的是:
dialet=com.liferay.portal.spring.hibernate.DynamicDialect
此dialet使用hiberante中的DialectFactory.determineDialect(dbName, dbMajorVersion)动态判断
如果采用比较特殊的数据库,可以将dialet替换成实际使用的数据库方言。
hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory
该设置是为了避免同weblogic中的ANTLR版本冲突。
引用
#
# Use the classic query factory until WebLogic and Hibernate 3 can get
# along. See http://www.hibernate.org/250.html#A23 for more information.
#
# Use the classic query factory until WebLogic and Hibernate 3 can get
# along. See http://www.hibernate.org/250.html#A23 for more information.
#
使用ClassicQueryTranslatorFactory不能在代码中使用hibernate3的新式hql,比如delete语句。
如果不用weblogic,可以将此设置改为
hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory
hibernate session在spring中bean名字为
liferaySessionFactory