📄 baseauthor.java
字号:
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 Author */public abstract class BaseAuthor extends BaseObject{ /** The Peer class */ private static final AuthorPeer peer = new AuthorPeer(); /** The value for the authorId field */ private int authorId; /** The value for the firstName field */ private String firstName; /** The value for the lastName field */ private String lastName; /** * Get the AuthorId * * @return int */ public int getAuthorId() { return authorId; } /** * Set the value of AuthorId * * @param v new value */ public void setAuthorId(int v) throws TorqueException { if (this.authorId != v) { this.authorId = v; setModified(true); } // update associated Book if (collBooks != null) { for (int i = 0; i < collBooks.size(); i++) { ((Book) collBooks.get(i)) .setAuthorId(v); } } } /** * Get the FirstName * * @return String */ public String getFirstName() { return firstName; } /** * Set the value of FirstName * * @param v new value */ public void setFirstName(String v) { if (!ObjectUtils.equals(this.firstName, v)) { this.firstName = v; setModified(true); } } /** * Get the LastName * * @return String */ public String getLastName() { return lastName; } /** * Set the value of LastName * * @param v new value */ public void setLastName(String v) { if (!ObjectUtils.equals(this.lastName, v)) { this.lastName = 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.setAuthor((Author) 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 Author has previously * been saved, it will retrieve related Books from storage. * If this Author 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.AUTHOR_ID, getAuthorId() ); 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.AUTHOR_ID, getAuthorId()); 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 Author has previously * been saved, it will retrieve related Books from storage. * If this Author 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.AUTHOR_ID, getAuthorId()); 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.AUTHOR_ID, getAuthorId()); 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 Author is new, it will return * an empty collection; or if this Author 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 Author. */ protected List getBooksJoinPublisher(Criteria criteria) throws TorqueException { if (collBooks == null) { if (isNew()) { collBooks = new ArrayList(); } else { criteria.add(BookPeer.AUTHOR_ID, getAuthorId()); collBooks = BookPeer.doSelectJoinPublisher(criteria); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -