I have the follow object:
@Entity
@Table(name="slideshow")
@Searchable
public class SlideShow implements Serializable {
@Id
@GeneratedValue(generator="slideShowSeq")
@SequenceGenerator(name="slideShowSeq", sequenceName="slideshow_seq")
@SearchableId
int slideShowId
@SearchableProperty
String name
@ManyToOne
@JoinColumn(name = "userid", referencedColumnName="userid")
User user
@ManyToOne
@JoinColumn(name = "eventid")
Event event
...
}
eventId and userId are fks in slideshow table. By default User and Event should be lazy loaded to SlideShow by proxy. Hence, I should be able to get eventId and userId from slideShow.getEvent().getEventId() However, the eventId is null when I step through the proxy object in debugger. Same is true for userId.
Furthermore, if eventId and userId are available if I add
int eventId;
String userId;
to the class. But that's kind of duplicating hibernate's function, right?
Am I missing something? Should the proxy object has the id of the associate object loaded lazily? How does one retrieve it? Thank you for all your help.