<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="2.0" xmlns="http://java.sun.com/xml/ns/persistence/orm"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">

    <package>org.apache.roller.weblogger.pojos</package>
    <entity metadata-complete="true" name="WeblogHitCount" class="org.apache.roller.weblogger.pojos.WeblogHitCount"
            access="PROPERTY">
        <table name="roller_hitcounts"/>
        <named-query name="WeblogHitCount.getByWeblog">
            <query>SELECT h FROM WeblogHitCount h WHERE h.weblog = ?1</query>
        </named-query>
        <named-query name="WeblogHitCount.getByWeblogEnabledTrueAndActiveTrue&amp;DailyHitsGreaterThenZero&amp;WeblogLastModifiedGreaterOrderByDailyHitsDesc">
            <query>SELECT h FROM WeblogHitCount h WHERE h.weblog.visible = true AND h.weblog.active = true AND h.weblog.lastModified > ?1 AND h.dailyHits > 0 ORDER BY h.dailyHits DESC</query>
        </named-query>
        <named-query name="WeblogHitCount.updateDailyHitCountZero">
            <query>UPDATE WeblogHitCount h SET h.dailyHits = 0</query>
        </named-query>
        <attributes>
            <id name="id">
                <column name="id"/>
            </id>
            <basic name="dailyHits">
                <column name="dailyhits" insertable="true" updatable="true" unique="false"/>
            </basic>
            <many-to-one name="weblog" target-entity="org.apache.roller.weblogger.pojos.Weblog">
                <join-column name="websiteid" insertable="true" updatable="true" nullable="false"/>
            </many-to-one>
        </attributes>
    </entity>
</entity-mappings>
