Hi!
We want to have data from two different classes merged in one index. The classes represent tables with a one-to-one relationship but they are not marked @OneToOne in Hibernate. One class (Vehicle) is the master, the other (VehiclePrices) is initialized with the same id.
We cannot have a OneToOne because both classes live in different modules and must not know each other (only a third module knows both).
Now, we want to have the data of both classes merged in one index.
Is this possible with HS? If yes, how can we do this? If no, is there another way?
Cheers,
Chris
PS: here's some example code. This is what I tried: i put both classes in the same index - but now there is a document for Vehicle and one for VehiclePrice.
Code:
@Entity
@Indexed(index="vehicle")
public class Vehicle
{
@Id
@DocumentId
@GeneratedValue
private Long id;
@Column(length = 17)
@Field
private String vin;
...
}
Code:
@Entity
@Indexed(index = "vehicle")
public class VehiclePrice
{
@Id
@DocumentId
private Long id;
@Column(precision = 9, scale = 2)
@Field
private BigDecimal price;
public VehiclePrice(Long vehicleId, BigDecimal price)
{
super();
this.id = vehicleId;
this.price = price;
}
...
}