• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TWO @Ids must work in hibernate

 
shravani kondreddi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How i can declare TWO @Id in a single entity. My problem is both @Id must work. I am sending entity class

/**
*
*/
package com.moontech.eseva.entity;

import java.io.Serializable;

import javax.annotation.Generated;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MapsId;
import javax.persistence.Table;

import org.hibernate.annotations.NaturalId;

/**
* @author admin
*
*/

@Entity
@Table(name = "APHB_RENTS_DTS")
@DiscriminatorColumn(name="tenantCode")
public class AphbRentDTO implements Serializable{


@Id
@Column(name = "BUILD_CODE")
private String buildCode;
@Column(name = "BUILD_NAME")
private String buildName;
@Column(name = "TENANT_TYPE")
private String tenantType;

@Id
@Column(name = "TENANT_CODE")
private String tenantCode;
@Column(name = "TENANT_NAME")
private String tenantName;
@Column(name = "MONTH_RENT")
private String monthRent;
@Column(name = "ARREARS")
private String arrears;
@Column(name = "ARREARS_DATE")
private String arrearsDate;
@Column(name = "UPD_DATE")
private String updDate;
@Column(name = "BLOCK_FLOOR", length = 300)
private String blockFloor;


public String getBuildCode() {
return this.buildCode;
}

public void setBuildCode(String buildCode) {
this.buildCode = buildCode;
}


public String getBuildName() {
return this.buildName;
}

public void setBuildName(String buildName) {
this.buildName = buildName;
}


public String getTenantType() {
return this.tenantType;
}

public void setTenantType(String tenantType) {
this.tenantType = tenantType;
}


public String getTenantCode() {
return this.tenantCode;
}

public void setTenantCode(String tenantCode) {
this.tenantCode = tenantCode;
}


public String getTenantName() {
return this.tenantName;
}

public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}


public String getMonthRent() {
return this.monthRent;
}

public void setMonthRent(String monthRent) {
this.monthRent = monthRent;
}


public String getArrears() {
return this.arrears;
}

public void setArrears(String arrears) {
this.arrears = arrears;
}


public String getArrearsDate() {
return this.arrearsDate;
}

public void setArrearsDate(String arrearsDate) {
this.arrearsDate = arrearsDate;
}


public String getUpdDate() {
return this.updDate;
}

public void setUpdDate(String updDate) {
this.updDate = updDate;
}


public String getBlockFloor() {
return this.blockFloor;
}

public void setBlockFloor(String blockFloor) {
this.blockFloor = blockFloor;
}



}


Thank you.
Shravani







 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic