留言板
Reg: Session
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
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
You typically never need the hibernate session and, if you think you do, you're probably doing something wrong.
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
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
Have you tried DynamicQuery?
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);
}
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);
}