⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basepublisher.java

📁 Torque示例
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.becom.om;import java.math.BigDecimal;import java.sql.Connection;import java.util.ArrayList;import java.util.Date;import java.util.Collections;import java.util.List;import org.apache.commons.lang.ObjectUtils;import org.apache.torque.TorqueException;import org.apache.torque.om.BaseObject;import org.apache.torque.om.ComboKey;import org.apache.torque.om.DateKey;import org.apache.torque.om.NumberKey;import org.apache.torque.om.ObjectKey;import org.apache.torque.om.SimpleKey;import org.apache.torque.om.StringKey;import org.apache.torque.om.Persistent;import org.apache.torque.util.Criteria;import org.apache.torque.util.Transaction;/** * This class was autogenerated by Torque on: * * [Tue Apr 20 13:21:09 CST 2004] * * You should not use this class directly.  It should not even be * extended all references should be to Publisher */public abstract class BasePublisher extends BaseObject{    /** The Peer class */    private static final PublisherPeer peer =        new PublisherPeer();            /** The value for the publisherId field */    private int publisherId;          /** The value for the name field */    private String name;          /**     * Get the PublisherId     *     * @return int     */    public int getPublisherId()    {        return publisherId;    }                                                  /**     * Set the value of PublisherId     *     * @param v new value     */    public void setPublisherId(int v) throws TorqueException    {                      if (this.publisherId != v)              {            this.publisherId = v;            setModified(true);        }                                                        // update associated Book        if (collBooks != null)        {            for (int i = 0; i < collBooks.size(); i++)            {                ((Book) collBooks.get(i))                    .setPublisherId(v);            }        }                      }      /**     * Get the Name     *     * @return String     */    public String getName()    {        return name;    }                            /**     * Set the value of Name     *     * @param v new value     */    public void setName(String v)     {                      if (!ObjectUtils.equals(this.name, v))              {            this.name = v;            setModified(true);        }                            }                                                           /**     * Collection to store aggregation of collBooks     */    protected List collBooks;    /**     * Temporary storage of collBooks to save a possible db hit in     * the event objects are add to the collection, but the     * complete collection is never requested.     */    protected void initBooks()    {        if (collBooks == null)        {            collBooks = new ArrayList();        }    }    /**     * Method called to associate a Book object to this object     * through the Book foreign key attribute     *     * @param l Book     * @throws TorqueException     */    public void addBook(Book l) throws TorqueException    {        getBooks().add(l);        l.setPublisher((Publisher) this);    }    /**     * The criteria used to select the current contents of collBooks     */    private Criteria lastBooksCriteria = null;    /**     * If this collection has already been initialized, returns     * the collection. Otherwise returns the results of     * getBooks(new Criteria())     *     * @throws TorqueException     */    public List getBooks() throws TorqueException    {        if (collBooks == null)        {            collBooks = getBooks(new Criteria(10));        }        return collBooks;    }    /**     * If this collection has already been initialized with     * an identical criteria, it returns the collection.     * Otherwise if this Publisher has previously     * been saved, it will retrieve related Books from storage.     * If this Publisher is new, it will return     * an empty collection or the current collection, the criteria     * is ignored on a new object.     *     * @throws TorqueException     */    public List getBooks(Criteria criteria) throws TorqueException    {        if (collBooks == null)        {            if (isNew())            {               collBooks = new ArrayList();            }            else            {                      criteria.add(BookPeer.PUBLISHER_ID, getPublisherId() );                      collBooks = BookPeer.doSelect(criteria);            }        }        else        {            // criteria has no effect for a new object            if (!isNew())            {                // the following code is to determine if a new query is                // called for.  If the criteria is the same as the last                // one, just return the collection.                      criteria.add(BookPeer.PUBLISHER_ID, getPublisherId());                      if (!lastBooksCriteria.equals(criteria))                {                    collBooks = BookPeer.doSelect(criteria);                }            }        }        lastBooksCriteria = criteria;        return collBooks;    }    /**     * If this collection has already been initialized, returns     * the collection. Otherwise returns the results of     * getBooks(new Criteria(),Connection)     * This method takes in the Connection also as input so that     * referenced objects can also be obtained using a Connection     * that is taken as input     */    public List getBooks(Connection con) throws TorqueException    {        if (collBooks == null)        {            collBooks = getBooks(new Criteria(10), con);        }        return collBooks;    }    /**     * If this collection has already been initialized with     * an identical criteria, it returns the collection.     * Otherwise if this Publisher has previously     * been saved, it will retrieve related Books from storage.     * If this Publisher is new, it will return     * an empty collection or the current collection, the criteria     * is ignored on a new object.     * This method takes in the Connection also as input so that     * referenced objects can also be obtained using a Connection     * that is taken as input     */    public List getBooks(Criteria criteria, Connection con)            throws TorqueException    {        if (collBooks == null)        {            if (isNew())            {               collBooks = new ArrayList();            }            else            {                       criteria.add(BookPeer.PUBLISHER_ID, getPublisherId());                       collBooks = BookPeer.doSelect(criteria, con);             }         }         else         {             // criteria has no effect for a new object             if (!isNew())             {                 // the following code is to determine if a new query is                 // called for.  If the criteria is the same as the last                 // one, just return the collection.                       criteria.add(BookPeer.PUBLISHER_ID, getPublisherId());                       if (!lastBooksCriteria.equals(criteria))                 {                     collBooks = BookPeer.doSelect(criteria, con);                 }             }         }         lastBooksCriteria = criteria;         return collBooks;     }                                                                                                                                                                                                                                                                                    /**     * If this collection has already been initialized with     * an identical criteria, it returns the collection.     * Otherwise if this Publisher is new, it will return     * an empty collection; or if this Publisher has previously     * been saved, it will retrieve related Books from storage.     *     * This method is protected by default in order to keep the public     * api reasonable.  You can provide public methods for those you     * actually need in Publisher.     */    protected List getBooksJoinPublisher(Criteria criteria)        throws TorqueException    {        if (collBooks == null)        {            if (isNew())            {               collBooks = new ArrayList();            }            else            {                            criteria.add(BookPeer.PUBLISHER_ID, getPublisherId());                            collBooks = BookPeer.doSelectJoinPublisher(criteria);            }        }        else        {            // the following code is to determine if a new query is            // called for.  If the criteria is the same as the last            // one, just return the collection.            boolean newCriteria = true;                        criteria.add(BookPeer.PUBLISHER_ID, getPublisherId());

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -