After migrating to Hibernate3, the following query can't be executed.
<code>
select <font color="red">rightGroup.right</font> from RightGroup rightGroup inner join rightGroup.userGroups userRightGroup where userRightGroup.userNo = ? and rightGroup.corpNo = ? and rightGroup.valid=1
</code>
The error message is:
<code>
unexpected token: . near line 1, column 18 [select <font color="red">rightGroup.right</font> from com.thunisoft.summer.right.data.RightGroup rightGroup inner join rightGroup.userGroups userRightGroup where userRightGroup.userNo = ? and rightGroup.corpNo = ? and rightGroup.valid=1]
</code>
but if I set the following propertie in hibernate.cfg.xml it works well:
<code>
<property name="hibernate.query.factory_class">
org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</property>
</code>
Hibernate version:
Hibernate3.0.5
Mapping documents:
<class name="RightGroup" table="T_WEB_RIGHTGROUP" lazy="true" mutable="false">
<id name="groupId" column="N_ID" type="string" unsaved-value="null">
<generator class="assigned"/>
</id>
<property name="name" column="C_NAME" type="string"/>
<font color="red">
<property name="right" column="T_RIGHT" type="binary"/>
</font>
<property name="valid" column="N_VALID" type="boolean"/>
<set name="userGroups" inverse="true" cascade="none" lazy="false">
<key column="N_RIGHTGROUPID"/>
<one-to-many class="UserRightGroup"/>
</set>
</class>
POJO:
<code>
public class RightGroup implements IRightGroup
{
protected String m_sGroupId = null;
protected String m_sName = null;
protected byte[] m_abyteRight = null;
protected boolean m_bValid = true;
private Set m_setUserGroup = new HashSet();
public String getGroupId()
{
return m_sGroupId;
}
public void setGroupId(String sGroupId)
{
m_sGroupId = sGroupId;
}
public String getName()
{
return m_sName;
}
public void setName(String sName)
{
m_sName = sName;
}
<font color="red">
public byte[] getRight()
{
return m_abyteRight;
}
public void setRight(byte[] abyteRight)
{
m_abyteRight = abyteRight;
}
</font>
public boolean isValid()
{
return m_bValid;
}
public void setValid(boolean bValid)
{
m_bValid = bValid;
}
public Set getUserGroups()
{
return m_setUserGroup;
}
public void setUserGroups(Set setUserGroup)
{
m_setUserGroup = setUserGroup;
}
}
</code>
Tables in database:
<code>
CREATE TABLE T_WEB_RIGHTGROUP
(
N_ID NUMBER(10) NOT NULL,
C_NAME VARCHAR2(50) NULL,
T_RIGHT RAW(500) NULL,
N_VALID NUMBER(1) NULL,
primary key(N_ID)
);
</code>
Full stack trace of any exception that occurs:
Caused by: org.hibernate.hql.ast.QuerySyntaxError: unexpected token: . near line 1, column 18 [select rightGroup.right from com.thunisoft.summer.right.data.RightGroup rightGroup inner join rightGroup.userGroups userRightGroup where userRightGroup.userNo = ? and rightGroup.corpNo = ? and rightGroup.valid=1]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:215)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at com.thunisoft.summer.data.db.hibernate.DataBridge4Hib8._loadObjectList(DataBridge4Hib8.java:2164)
at com.thunisoft.summer.data.db.hibernate.DataBridge4Hib8.loadObjectList(DataBridge4Hib8.java:412)
Name and version of the database you are using:
Oracle9.0.2
|