POJOのJavaのソース
package org.asyrinx.joey.gen.sample1.entity; import java.io.*; import java.util.*; import org.apache.commons.lang.builder.*; import org.asyrinx.joey.om.Entity; /** * BaseParty [ パーティ ] generated by joey-gen on Sat Nov 27 00:03:28 JST 2004 */ public class BaseParty implements Serializable, Entity { public BaseParty() { super(); } public BaseParty(long partyId, String partyCode, String name, String nameKana) { super(); this.partyId = partyId; this.partyCode = partyCode; this.name = name; this.nameKana = nameKana; } /* --------------------Properties -------------------- */ /** partyId [ パーティID ] */ private long partyId = 0; /** partyCode [ パーティコード ] */ private String partyCode = null; /** name [ 名前 ] */ private String name = null; /** nameKana [ カナ名 ] */ private String nameKana = null; /** * Get the partyId [ パーティID ] * * @return long * @hibernate.id generator-class="native" column="party_id" */ public long getPartyId() { return partyId; } /** * Get the partyCode [ パーティコード ] * * @return String * @hibernate.property column="party_code" */ public String getPartyCode() { return partyCode; } /** * Get the name [ 名前 ] * * @return String * @hibernate.property column="name" */ public String getName() { return name; } /** * Get the nameKana [ カナ名 ] * * @return String * @hibernate.property column="name_kana" */ public String getNameKana() { return nameKana; } /** * Set the partyId [ パーティID ] * * @param value * new value */ public void setPartyId(long value) { this.partyId = value; } /** * Set the partyCode [ パーティコード ] * * @param value * new value */ public void setPartyCode(String value) { this.partyCode = value; } /** * Set the name [ 名前 ] * * @param value * new value */ public void setName(String value) { this.name = value; } /** * Set the nameKana [ カナ名 ] * * @param value * new value */ public void setNameKana(String value) { this.nameKana = value; } /* --------------------Referring Objects -------------------- */ /* --------------------Referred Objects -------------------- */ private Set partyRelationsRelatedByOwnerPartyId = null; protected void setPartyRelationsRelatedByOwnerPartyIdInternal(Set partyRelationsRelatedByOwnerPartyId) { this.partyRelationsRelatedByOwnerPartyId = partyRelationsRelatedByOwnerPartyId; } /** * @hibernate.set lazy="true" * @hibernate.collection-key column="owner_party_id" * @hibernate.collection-one-to-many */ protected Set getPartyRelationsRelatedByOwnerPartyIdInternal() { if (this.partyRelationsRelatedByOwnerPartyId == null) { this.partyRelationsRelatedByOwnerPartyId = new HashSet(); } return this.partyRelationsRelatedByOwnerPartyId; } public List getPartyRelationsRelatedByOwnerPartyId() { //final List sortedPartyRelationsRelatedByOwnerPartyId = new // ArrayList(getPartyRelationsRelatedByOwnerPartyIdInternal()); //PropertyComparator.sort(sortedPartyRelationsRelatedByOwnerPartyId, // new MutableSortDefinition("name", true, true)); //return // Collections.unmodifiableList(sortedPartyRelationsRelatedByOwnerPartyId); return Collections.unmodifiableList(new ArrayList(getPartyRelationsRelatedByOwnerPartyIdInternal())); } /** * Add a PartyRelation to the List of partyRelationsRelatedByOwnerPartyId. * * @param partyRelationRelatedByOwnerPartyId * New PartyRelation to be added to the List of * partyRelationRelatedByOwnerPartyId */ public void addPartyRelationRelatedByOwnerPartyId(PartyRelation partyRelationRelatedByOwnerPartyId) { getPartyRelationsRelatedByOwnerPartyIdInternal().add(partyRelationRelatedByOwnerPartyId); } /** * remove a PartyRelation to the List of * partyRelationsRelatedByOwnerPartyId. * * @param partyRelationRelatedByOwnerPartyId * PartyRelation to be removed to the List of * partyRelationsRelatedByOwnerPartyId */ public void removePartyRelationRelatedByOwnerPartyId(PartyRelation partyRelationRelatedByOwnerPartyId) { getPartyRelationsRelatedByOwnerPartyIdInternal().remove(partyRelationRelatedByOwnerPartyId); } private Set partyRelationsRelatedByTargetPartyId = null; protected void setPartyRelationsRelatedByTargetPartyIdInternal(Set partyRelationsRelatedByTargetPartyId) { this.partyRelationsRelatedByTargetPartyId = partyRelationsRelatedByTargetPartyId; } /** * @hibernate.set lazy="true" * @hibernate.collection-key column="target_party_id" * @hibernate.collection-one-to-many */ protected Set getPartyRelationsRelatedByTargetPartyIdInternal() { if (this.partyRelationsRelatedByTargetPartyId == null) { this.partyRelationsRelatedByTargetPartyId = new HashSet(); } return this.partyRelationsRelatedByTargetPartyId; } public List getPartyRelationsRelatedByTargetPartyId() { //final List sortedPartyRelationsRelatedByTargetPartyId = new // ArrayList(getPartyRelationsRelatedByTargetPartyIdInternal()); //PropertyComparator.sort(sortedPartyRelationsRelatedByTargetPartyId, // new MutableSortDefinition("name", true, true)); //return // Collections.unmodifiableList(sortedPartyRelationsRelatedByTargetPartyId); return Collections.unmodifiableList(new ArrayList(getPartyRelationsRelatedByTargetPartyIdInternal())); } /** * Add a PartyRelation to the List of partyRelationsRelatedByTargetPartyId. * * @param partyRelationRelatedByTargetPartyId * New PartyRelation to be added to the List of * partyRelationRelatedByTargetPartyId */ public void addPartyRelationRelatedByTargetPartyId(PartyRelation partyRelationRelatedByTargetPartyId) { getPartyRelationsRelatedByTargetPartyIdInternal().add(partyRelationRelatedByTargetPartyId); } /** * remove a PartyRelation to the List of * partyRelationsRelatedByTargetPartyId. * * @param partyRelationRelatedByTargetPartyId * PartyRelation to be removed to the List of * partyRelationsRelatedByTargetPartyId */ public void removePartyRelationRelatedByTargetPartyId(PartyRelation partyRelationRelatedByTargetPartyId) { getPartyRelationsRelatedByTargetPartyIdInternal().remove(partyRelationRelatedByTargetPartyId); } /** * returns an id that differentiates this object from others of its class. */ public Serializable getPrimaryKey() { return new Long(getPartyId()); } public boolean equals(Object other) { if (!(other instanceof Party)) return false; Party castOther = (Party) other; return new EqualsBuilder().append(this.getPartyId(), castOther.getPartyId()).append(this.getPartyCode(), castOther.getPartyCode()).append(this.getName(), castOther.getName()).append(this.getNameKana(), castOther.getNameKana()).isEquals(); } public int hashCode() { return new HashCodeBuilder().append(this.getPartyId()).append(this.getPartyCode()).append(this.getName()) .append(this.getNameKana()).toHashCode(); } public String toString() { return new ToStringBuilder(this).append("partyId", this.getPartyId()).append("partyCode", this.getPartyCode()) .append("name", this.getName()).append("nameKana", this.getNameKana()).toString(); } }
package org.asyrinx.joey.gen.sample1.entity; import java.util.*; import org.asyrinx.brownie.core.util.Captionable; /** * Party [ パーティ ] generated by joey-gen on Sat Nov 27 00:03:28 JST 2004 * * @hibernate.class table="party" */ public class Party extends BaseParty implements Captionable { public Party() { super(); } public Party(long partyId, String partyCode, String name, String nameKana) { super(partyId, partyCode, name, nameKana); } /** * @see org.asyrinx.brownie.core.util.Captionable#getCaption() */ public String getCaption() { return String.valueOf(getPrimaryKey()); } }
関連やプロパティの実装はBaseXXXXクラスに、XXXXクラスはビジネスロジックを実装するためにほとんど実装がありません。Joeyのユーザに色々書いてもらうためです。
現在、Entityというインタフェースをimplementsしていますが、これは廃止する予定です。関連するオブジェクトへの参照も実装されます。