Visit
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.risinginfo.WebObserver.PersistentClass.Visit" table="Visit">
<id name="visitID" type="long" unsaved-value="null" >
<column name="VisitID" not-null="true"/>
<generator class="increment"/>
</id>
<many-to-one name="visitUser" cascade="none" class="com.risinginfo.WebObserver.PersistentClass.User">
<column name="UserID" sql-type="varchar(20)"/>
</many-to-one>
<many-to-one name="visitWeb" class="com.risinginfo.WebObserver.PersistentClass.Web"
column="WebID" cascade="none"/>
<property name="visitTime">
<column name="VisitTime"/>
</property>
</class>
</hibernate-mapping>
Web
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.risinginfo.WebObserver.PersistentClass.Web" table="Web">
<id name="webID" type="long" unsaved-value="null" >
<column name="WebID" not-null="true"/>
<generator class="increment"/>
</id>
<property name="domainName" type="java.lang.String">
<column name="webDN" not-null="true"/>
</property>
<property name="webName" >
<column name="WebName" sql-type="VARBINARY(255)" not-null="false"/>
</property>
</class>
</hibernate-mapping>
now I try the HQL like this
Code:
select Visit.visitWeb, count(elements(Visit.visitWeb))
from Visit Visit
group by count(elements(Visit.visitWeb))
but get error
Code:
net.sf.hibernate.QueryException: could not resolve property: elements of: com.risinginfo.WebObserver.PersistentClass.Web [select Visit.visitWeb, count(elements(Visit.visitWeb))
from com.risinginfo.WebObserver.PersistentClass.Visit Visit
group by count(elements(Visit.visitWeb))]