I'm have a fairly complex(to me at least) query that I need to translate to HQL.  It uses some MySQL date functions.  Anyway here's the sql and all relevant code:
 
Code:
select count(id),DATE_FORMAT(MAIL_DATE,'%U %X') as week from dmm_request_log where year(MAIL_DATE)='2004' group by week ;
The pojo:
Code:
package com.package.model;
import java.util.Date;
/**
 * @hibernate.class table="dmm_request_log" 
 */
public class GuidebookRequest {
   
   Long id;
   String adId;
   String email;
   String name1;
   String name2;
   String city;
   String state;
   String zip;
   String country;
   String source;
   Date mailDate;
   Date fileDate;
   
   public GuidebookRequest() {
      
   }
   /**
    * @return the id
    * @hibernate.id generator-class="native" column="id"
    */
   public Long getId() {
      return id;
   }
   /**
    * @param id the id to set
    */
   public void setId(Long id) {
      this.id = id;
   }
   /**
    * @return the adId
    * @hibernate.property column="ad_id"
    */
   public String getAdId() {
      return adId;
   }
   /**
    * @param adId the adId to set
    */
   public void setAdId(String adId) {
      this.adId = adId;
   }
   /**
    * @return the city
    * @hibernate.property column="city"
    */
   public String getCity() {
      return city;
   }
   /**
    * @param city the city to set
    */
   public void setCity(String city) {
      this.city = city;
   }
   /**
    * @return the country
    * @hibernate.property column="country"
    */
   public String getCountry() {
      return country;
   }
   /**
    * @param country the country to set
    */
   public void setCountry(String country) {
      this.country = country;
   }
   /**
    * @return the email
    * @hibernate.property column="email"
    */
   public String getEmail() {
      return email;
   }
   /**
    * @param email the email to set
    */
   public void setEmail(String email) {
      this.email = email;
   }
   /**
    * @return the fileDate
    * @hibernate.property column="file_date"
    */
   public Date getFileDate() {
      return fileDate;
   }
   /**
    * @param fileDate the fileDate to set
    */
   public void setFileDate(Date fileDate) {
      this.fileDate = fileDate;
   }
   /**
    * @return the mailDate
    * @hibernate.property column="mail_date"
    */
   public Date getMailDate() {
      return mailDate;
   }
   /**
    * @param mailDate the mailDate to set
    */
   public void setMailDate(Date mailDate) {
      this.mailDate = mailDate;
   }
   /**
    * @return the name1
    * @hibernate.property column="name1"
    */
   public String getName1() {
      return name1;
   }
   /**
    * @param name1 the name1 to set
    */
   public void setName1(String name1) {
      this.name1 = name1;
   }
   /**
    * @return the name2
    * @hibernate.property column="name2"
    */
   public String getName2() {
      return name2;
   }
   /**
    * @param name2 the name2 to set
    */
   public void setName2(String name2) {
      this.name2 = name2;
   }
   /**
    * @return the source
    * @hibernate.property column="source"
    */
   public String getSource() {
      return source;
   }
   /**
    * @param source the source to set
    */
   public void setSource(String source) {
      this.source = source;
   }
   /**
    * @return the state
    * @hibernate.property column="state"
    */
   public String getState() {
      return state;
   }
   /**
    * @param state the state to set
    */
   public void setState(String state) {
      this.state = state;
   }
   /**
    * @return the zip
    * @hibernate.property column="zip4"
    */
   public String getZip() {
      return zip;
   }
   /**
    * @param zip the zip to set
    */
   public void setZip(String zip) {
      this.zip = zip;
   }
   
   
}
And the mapping:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
>
    <class
        name="com.package.model.GuidebookRequest"
        table="dmm_request_log"
    >
        <id
            name="id"
            column="id"
            type="java.lang.Long"
        >
            <generator class="native">
              <!--  
                  To add non XDoclet generator parameters, create a file named 
                  hibernate-generator-params-GuidebookRequest.xml 
                  containing the additional parameters and place it in your merge dir. 
              --> 
            </generator>
        </id>
        <property
            name="adId"
            type="java.lang.String"
            update="true"
            insert="true"
            column="ad_id"
        />
        <property
            name="city"
            type="java.lang.String"
            update="true"
            insert="true"
            column="city"
        />
        <property
            name="country"
            type="java.lang.String"
            update="true"
            insert="true"
            column="country"
        />
        <property
            name="email"
            type="java.lang.String"
            update="true"
            insert="true"
            column="email"
        />
        <property
            name="fileDate"
            type="java.util.Date"
            update="true"
            insert="true"
            column="file_date"
        />
        <property
            name="mailDate"
            type="java.util.Date"
            update="true"
            insert="true"
            column="mail_date"
        />
        <property
            name="name1"
            type="java.lang.String"
            update="true"
            insert="true"
            column="name1"
        />
        <property
            name="name2"
            type="java.lang.String"
            update="true"
            insert="true"
            column="name2"
        />
        <property
            name="source"
            type="java.lang.String"
            update="true"
            insert="true"
            column="source"
        />
        <property
            name="state"
            type="java.lang.String"
            update="true"
            insert="true"
            column="state"
        />
        <property
            name="zip"
            type="java.lang.String"
            update="true"
            insert="true"
            column="zip4"
        />
        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-GuidebookRequest.xml
            containing the additional properties and place it in your merge dir.
        -->
    </class>
</hibernate-mapping>