Hello,
Small question, I have association between 2 entities (Person & Version) as follow:
This class is part of person entity:
Code:
@MappedSuperclass
public abstract class VersionedObject implements Cloneable, Serializable {
@Id
@DocumentId
@FieldBridge(impl=PkFieldBridge.class)
private VersionKey pk;
VersionKey:
Code:
@Embeddable
public class VersionKey implements Serializable, Cloneable {
@JoinColumn(name="V_NO")
@ManyToOne(targetEntity=Version.class, fetch=FetchType.EAGER)
private Version version;
@Column(nullable=false)
private Integer id;
Here the fetch type is eager.
Each time that I use hibernate (not hibernate search) to retrieve the person entity, I have the Version object attached without any problem.
But once that I use hibernate search, I have all my Persons objects but without the version attached.
Do I have to add something in the Version entity?
Currently it's defined like a simple entity:
Code:
@Entity
@Table(name="VERSIONS")
public class Version implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="V_NO", length=10)
private Integer valueNb;
@Column(nullable=false)
@Temporal(TemporalType.TIMESTAMP)
private Date tstamp;
@Column(length=UserProfile.CAID_LENGTH, nullable=false)
private String userId;
@Column(length=500)
private String message;