package ch.ffhs.webE.domain;
// Generated 19.12.2010 14:46:08 by Hibernate Tools 3.4.0.Beta1
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
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;
/**
* Relationship generated by hbm2java
*/
@
Entity
@Table
(name =
"relationship", catalog =
"webengineering", uniqueConstraints = @UniqueConstraint
(columnNames =
{
"term_from",
"term_to",
"type_id" }))
public class Relationship
implements java.
io.
Serializable
{
private int objectId
;
@Transient
private ObjectEntity object
;
private Term termFrom
;
private Term termTo
;
private RelationshipType relationshipType
;
public Relationship
()
{
}
public Relationship
(Term termByTermTo, ObjectEntity object,
RelationshipType relationshipType, Term termByTermFrom
)
{
this.
termTo = termByTermTo
;
this.
object = object
;
this.
relationshipType = relationshipType
;
this.
termFrom = termByTermFrom
;
}
@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;
}
public void setObjectId
(int objectId
)
{
this.
objectId = objectId
;
}
@ManyToOne
(fetch = FetchType.
LAZY)
@JoinColumn
(name =
"term_to", nullable =
false)
public Term getTermTo
()
{
return this.
termTo;
}
public void setTermTo
(Term termByTermTo
)
{
this.
termTo = termByTermTo
;
}
@OneToOne
(fetch = FetchType.
LAZY)
@PrimaryKeyJoinColumn
public ObjectEntity getObject
()
{
return this.
object;
}
public void setObject
(ObjectEntity object
)
{
this.
object = object
;
}
@ManyToOne
(fetch = FetchType.
LAZY)
@JoinColumn
(name =
"type_id", nullable =
false)
public RelationshipType getRelationshipType
()
{
return this.
relationshipType;
}
public void setRelationshipType
(RelationshipType relationshipType
)
{
this.
relationshipType = relationshipType
;
}
@ManyToOne
(fetch = FetchType.
LAZY)
@JoinColumn
(name =
"term_from", nullable =
false)
public Term getTermFrom
()
{
return this.
termFrom;
}
public void setTermFrom
(Term termByTermFrom
)
{
this.
termFrom = termByTermFrom
;
}
}