Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as Java by kossmoboleat ( 15 years ago )
package org.hibernate.test.annotations.onetoone.referencedcolumnname;
import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;

import org.hibernate.annotations.ForeignKey;

@Entity
public class HI implements Serializable {

 private static final long serialVersionUID = -1200674512191797147L;
 
 private String id;

 private H h;

 @OneToOne
 @JoinColumn(name = "objIdH", referencedColumnName = "objId")
 @ForeignKey(name = "none")
 public H getH() {
  return this.h;
 }

 public void setH(H h) {
  this.h = h;
 }

 @Id
 public String getId() {
  return id;
 }

 public void setId(String id) {
  this.id = id;
 }

 @Override
 public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + ((id == null) ? 0 : id.hashCode());
  return result;
 }

 @Override
 public boolean equals(Object obj) {
  if (this == obj)
   return true;
  if (obj == null)
   return false;
  if (!(obj instanceof HI))
   return false;
  HI other = (HI) obj;
  if (id == null) {
   if (other.id != null)
    return false;
  } else if (!id.equals(other.id))
   return false;
  return true;
 }
}

 

Revise this Paste

Your Name: Code Language: