留言板

Reg: Session

Santanu Mohanty,修改在9 年前。

Reg: Session

New Member 帖子: 5 加入日期: 14-11-17 最近的帖子
HI,

I am using liferay6.1.1 service builder.
How to get the hibernet Session from the liferay Session ?
I have tried in some ways. But I got exception as org.hibernate.dialect.SQLServerDialect cannot be cast to org.hibernate.dialect.Dialect.
Please find the attachment.


Thanks,
Santanu
thumbnail
David H Nebinger,修改在9 年前。

RE: Reg: Session

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
You typically never need the hibernate session and, if you think you do, you're probably doing something wrong.
Santanu Mohanty,修改在9 年前。

RE: Reg: Session

New Member 帖子: 5 加入日期: 14-11-17 最近的帖子
Hi David,

I need Criteria to join two or more tables, So I went for Hibernet Session. Since there is no Criteria in liferay how I can join two or more tables in liferay. I dont want to use custom query since the query syntax is different for every Database. Like Oracle, MsSql.


Thanks,
Santanu
thumbnail
David H Nebinger,修改在9 年前。

RE: Reg: Session

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Have you tried DynamicQuery?
Santanu Mohanty,修改在9 年前。

RE: Reg: Session

New Member 帖子: 5 加入日期: 14-11-17 最近的帖子
Yes . I have tried , but not able to join. I did like this...

Table 1 :RelationshipBuilder
Table 2: RelationshipBuilderHistory

The FK is relationshipBuilderSystemId;

I got HibernateMapping Exception.

public void search() throws Exception {

DynamicQuery rBquery = DynamicQueryFactoryUtil.forClass(RelationshipBuilder.class,"RB", PortalClassLoaderUtil.getClassLoader())
.setProjection(ProjectionFactoryUtil.property("RB.relationshipName"))
.add(PropertyFactoryUtil.forName("RB.relationshipBuilderSystemId").eqProperty("RBH.relationshipBuilderSystemId"));

DynamicQuery rBHquery=DynamicQueryFactoryUtil.forClass(RelationshipBuilderHistory.class,"RBH" ,PortalClassLoaderUtil.getClassLoader())
.add(PropertyFactoryUtil.forName("RBH.relationshipName").in(rBquery));

List resultList=new ArrayList();
resultList = dao.getRelationshipBuilderHistoryList(rBHquery);
}