I have a Hibernate object where I need a member variable to reference an object that points to a different database. So for example, I need something like this:
Code:
@Entity
@Table(name = "hibernate_test")
public class HibernateObject implements Serializable {
private static final long serialVersionUID = -8889984662603797899L;
public HibernateObject() {
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
Integer id;
@Column(name = "name")
String name;
EnrichedColumn object; // This object would point to a different database
public void setEnrichedColumn(EnrichedColumn col) {
this.object = col;
}
public EnrichedColumn getEnrichedColumn() {
return this.object;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
...
}
And the EnrichedColumn object member variable would point to an object that looked like this:
Code:
@Entity
@Table(name = "enriched_column_test")
public class EnrichedColumn {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
Integer id;
@Column(name = "name")
String name;
public EnrichedColumn() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Is there any way to do this?