<?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="MediaFile"
            class="org.apache.roller.weblogger.pojos.MediaFile" access="PROPERTY">
        <table name="roller_mediafile"/>
        <named-query name="MediaFile.getByWeblogAndOrigpath">
            <query>SELECT f FROM MediaFile f WHERE f.weblog = ?1 AND f.originalPath = ?2</query>
        </named-query>
        <attributes>
            <id name="id">
                <column name="id"/>
            </id>
            <basic name="name">
                <column name="name" insertable="true" updatable="true" unique="false" nullable="false"/>
            </basic>
            <basic name="width">
                <column name="width" insertable="true" updatable="true" unique="false" nullable="true"/>
            </basic>
            <basic name="height">
                <column name="height" insertable="true" updatable="true" unique="false" nullable="true"/>
            </basic>
            <basic name="originalPath">
                <column name="origpath" insertable="true" updatable="true" unique="false" nullable="true"/>
            </basic>
            <basic name="description">
                <column name="description" insertable="true" updatable="true" unique="false" nullable="true"/>
            </basic>
            <basic name="contentType">
                <column name="content_type" insertable="true" updatable="true" unique="false" nullable="false"/>
            </basic>
            <basic name="copyrightText">
                <column name="copyright_text" insertable="true" updatable="true" unique="false" nullable="true"/>
            </basic>
            <basic name="length">
                <column name="size_in_bytes" insertable="true" updatable="true" unique="false" nullable="true"/>
            </basic>
            <basic name="dateUploaded">
                <column name="date_uploaded" insertable="true" updatable="true" unique="false"/>
            </basic>
            <basic name="lastUpdated">
                <column name="last_updated" insertable="true" updatable="true" unique="false"/>
            </basic>
            <basic name="sharedForGallery">
                <column name="is_public" insertable="true" updatable="true" unique="false" nullable="false" />
            </basic>
            <basic name="creatorUserName">
                <column name="creator" insertable="true" updatable="true" unique="false" />
            </basic>
            <many-to-one name="directory" target-entity="org.apache.roller.weblogger.pojos.MediaFileDirectory">
                <join-column name="directoryid" insertable="true" updatable="true" nullable="false"/>
            </many-to-one>
            <many-to-one name="weblog" target-entity="org.apache.roller.weblogger.pojos.Weblog">
                <join-column name="weblogid" insertable="true" updatable="true" nullable="false"/>
            </many-to-one>
            <one-to-many name="tags" mapped-by="mediaFile" target-entity="org.apache.roller.weblogger.pojos.MediaFileTag" fetch="LAZY">
                <cascade>
                    <cascade-persist /> <!-- Added so entry added by addTag() gets persisted -->
                    <cascade-remove />
                </cascade>
            </one-to-many>
            <transient name="thumbnailURL"/>
            <transient name="permalink"/>
            <transient name="lastModified"/>
            <transient name="path"/>
            <transient name="creator"/>
            <transient name="imageFile"/>
            <transient name="addedTags"/>
            <transient name="removedTags"/>
            <transient name="tagsAsString"/>
            <transient name="inputStream"/>
            <transient name="thumbnailInputStream"/>
            <transient name="thumbnailHeight"/>
            <transient name="thumbnailWidth"/>
        </attributes>
    </entity>
</entity-mappings>
