Subversion Repositories WebE

Rev

Rev 34 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

1
package ch.ffhs.webE.domain;

// Generated 19.12.2010 14:46:08 by Hibernate Tools 3.4.0.Beta1

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

/**
 * Term generated by hbm2java
 */

@Entity
@Table(name = "term", catalog = "webengineering", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class Term implements Serializable
{
  /**
   * Version ID for serialization
   */

  private static final long serialVersionUID = 1L;

  @Transient
  private int objectId;

  private ObjectEntity object;
  private String name;
  private Set<Relationship> relationshipsForTermTo = new HashSet<Relationship>(
      0);
  private Set<Relationship> relationshipsForTermFrom = new HashSet<Relationship>(
      0);

  /**
   * No-op constructor
   */

  public Term()
  {
  }

  /**
   * @param object
   */

  public Term(ObjectEntity object)
  {
    this.object = object;
  }

  /**
   * @param object
   * @param name
   * @param relationshipsForTermTo
   * @param relationshipsForTermFrom
   */

  public Term(ObjectEntity object, String name,
      Set<Relationship> relationshipsForTermTo,
      Set<Relationship> relationshipsForTermFrom)
  {
    this.object = object;
    this.name = name;
    this.relationshipsForTermTo = relationshipsForTermTo;
    this.relationshipsForTermFrom = relationshipsForTermFrom;
  }

  /**
   * @return
   */

  @GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "object"))
  @Id
  @GeneratedValue(generator = "generator")
  @Column(name = "object_id", unique = true, nullable = false)
  public int getObjectId()
  {
    return this.objectId;
  }

  /**
   * @param objectId
   */

  public void setObjectId(int objectId)
  {
    this.objectId = objectId;
  }

  /**
   * @return ObjectEntity domain object
   */

  @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
  @PrimaryKeyJoinColumn
  public ObjectEntity getObject()
  {
    return this.object;
  }

  /**
   * @param object
   */

  public void setObject(ObjectEntity object)
  {
    this.object = object;
  }

  /**
   * @return
   */

  @Column(name = "name", unique = true)
  public String getName()
  {
    return this.name;
  }

  /**
   * @param name
   */

  public void setName(String name)
  {
    this.name = name;
  }

  @OneToMany(fetch = FetchType.LAZY, mappedBy = "termTo")
  public Set<Relationship> getRelationshipsForTermTo()
  {
    return this.relationshipsForTermTo;
  }

  /**
   * @param relationshipsForTermTo
   */

  public void setRelationshipsForTermTo(Set<Relationship> relationshipsForTermTo)
  {
    this.relationshipsForTermTo = relationshipsForTermTo;
  }

  /**
   * @return
   */

  @OneToMany(fetch = FetchType.LAZY, mappedBy = "termFrom")
  public Set<Relationship> getRelationshipsForTermFrom()
  {
    return this.relationshipsForTermFrom;
  }

  /**
   * @param relationshipsForTermFrom
   */

  public void setRelationshipsForTermFrom(
      Set<Relationship> relationshipsForTermFrom)
  {
    this.relationshipsForTermFrom = relationshipsForTermFrom;
  }

}