package org.webonweb.runtime.impl.repository.db.jpa;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/**
* Entity class DbAppKey
*
* @author Chris Webster
*/
@Entity
@Table(name = "APP_KEY")
@NamedQueries( {
@NamedQuery(name = "DbAppKey.findByAppKeySetId", query = "SELECT d FROM DbAppKey d WHERE d.dbAppKeyPK.appKeySetId = :appKeySetId"),
@NamedQuery(name = "DbAppKey.findByKeyTypeId", query = "SELECT d FROM DbAppKey d WHERE d.dbAppKeyPK.keyTypeId = :keyTypeId"),
@NamedQuery(name = "DbAppKey.findByKeyValue", query = "SELECT d FROM DbAppKey d WHERE d.keyValue = :keyValue")
})
public class DbAppKey implements Serializable {
/**
* EmbeddedId primary key field
*/
@EmbeddedId
protected DbAppKeyPK dbAppKeyPK;
@Column(name = "KEY_VALUE", nullable = false)
private String keyValue;
@JoinColumn(name = "KEY_TYPE_ID", referencedColumnName = "ID", insertable = false, updatable = false)
@ManyToOne(fetch=FetchType.LAZY)
private DbApiKeyType dbApiKeyType;
@JoinColumn(name = "APP_KEY_SET_ID", referencedColumnName = "ID", insertable = false, updatable = false)
@ManyToOne(fetch=FetchType.LAZY)
private DbAppKeySet dbAppKeySet;
/** Creates a new instance of DbAppKey */
public DbAppKey() {
}
/**
* Creates a new instance of DbAppKey with the specified values.
* @param dbAppKeyPK the dbAppKeyPK of the DbAppKey
*/
public DbAppKey(DbAppKeyPK dbAppKeyPK) {
this.dbAppKeyPK = dbAppKeyPK;
}
/**
* Creates a new instance of DbAppKey with the specified values.
* @param dbAppKeyPK the dbAppKeyPK of the DbAppKey
* @param keyValue the keyValue of the DbAppKey
*/
public DbAppKey(DbAppKeyPK dbAppKeyPK, String keyValue) {
this.dbAppKeyPK = dbAppKeyPK;
this.keyValue = keyValue;
}
/**
* Creates a new instance of DbAppKeyPK with the specified values.
* @param keyTypeId the keyTypeId of the DbAppKeyPK
* @param AppKeySetId the AppKeySetId of the DbAppKeyPK
*/
public DbAppKey(int keyTypeId, int appKeySetId) {
this.dbAppKeyPK = new DbAppKeyPK(keyTypeId, appKeySetId);
}
/**
* Gets the dbAppKeyPK of this DbAppKey.
* @return the dbAppKeyPK
*/
public DbAppKeyPK getDbAppKeyPK() {
return this.dbAppKeyPK;
}
/**
* Sets the dbAppKeyPK of this DbAppKey to the specified value.
* @param dbAppKeyPK the new dbAppKeyPK
*/
public void setDbAppKeyPK(DbAppKeyPK dbAppKeyPK) {
this.dbAppKeyPK = dbAppKeyPK;
}
/**
* Gets the keyValue of this DbAppKey.
* @return the keyValue
*/
public String getKeyValue() {
return this.keyValue;
}
/**
* Sets the keyValue of this DbAppKey to the specified value.
* @param keyValue the new keyValue
*/
public void setKeyValue(String keyValue) {
this.keyValue = keyValue;
}
/**
* Gets the dbApiKeyType of this DbAppKey.
* @return the dbApiKeyType
*/
public DbApiKeyType getDbApiKeyType() {
return this.dbApiKeyType;
}
/**
* Sets the dbApiKeyType of this DbAppKey to the specified value.
* @param dbApiKeyType the new dbApiKeyType
*/
public void setDbApiKeyType(DbApiKeyType dbApiKeyType) {
this.dbApiKeyType = dbApiKeyType;
}
/**
* Gets the dbAppKeySet of this DbAppKey.
* @return the dbAppKeySet
*/
public DbAppKeySet getDbAppKeySet() {
return this.dbAppKeySet;
}
/**
* Sets the dbAppKeySet of this DbAppKey to the specified value.
* @param dbAppKeySet the new dbAppKeySet
*/
public void setDbAppKeySet(DbAppKeySet dbAppKeySet) {
this.dbAppKeySet = dbAppKeySet;
}
/**
* Returns a hash code value for the object. This implementation computes
* a hash code value based on the id fields in this object.
* @return a hash code value for this object.
*/
@Override
public int hashCode() {
int hash = 0;
hash += (this.dbAppKeyPK != null ? this.dbAppKeyPK.hashCode() : 0);
return hash;
}
/**
* Determines whether another object is equal to this DbAppKey. The result is
* true
if and only if the argument is not null and is a DbAppKey object that
* has the same id field values as this object.
* @param object the reference object with which to compare
* @return true
if this object is the same as the argument;
* false
otherwise.
*/
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof DbAppKey)) {
return false;
}
DbAppKey other = (DbAppKey)object;
if (this.dbAppKeyPK != other.dbAppKeyPK && (this.dbAppKeyPK == null || !this.dbAppKeyPK.equals(other.dbAppKeyPK))) return false;
return true;
}
/**
* Returns a string representation of the object. This implementation constructs
* that representation based on the id fields.
* @return a string representation of the object.
*/
@Override
public String toString() {
return "jpa.DbAppKey[dbAppKeyPK=" + dbAppKeyPK + "]";
}
}