Hi
I have problem with fields marked as @Transient.
Please see the code below.
In Candidate Class..
Code:
@IndexedEmbedded
@Transient
@OneToMany(fetch= FetchType.LAZY )
@JoinTable(name="events", joinColumns = {@JoinColumn(name = "candidate_id")}, inverseJoinColumns = {@JoinColumn(name = "comment_id")})
public List<Comments> getComments() {
return comments;}
... //setter for the comments.
Comments.java........
Code:
@Entity
@Table(name = "comments")
@Indexed
public class Comments
{
private String commentId;
private String eventId;
private String comments;
private Date date;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@DocumentId
@Column(name = "comment_id")
public String getCommentId()
{
return commentId;
}
@Column(name = "event_id")
public String getEventId()
{
return eventId;
}
@Basic
@Column(name = "comments")
@Field(index = Index.TOKENIZED, store = Store.YES)
public String getComments()
{
return comments;
}
//setters...
}
If I DO NOT mark Comments as @Transient in Candidate.java, it saves 'comments' in DB properly, and gets indexed properly.
but INSERTS few null columns in 'events' table.
------
If I mark Comments as @Transient, it inserts 'comments' as well as 'events' into DB properly
but fails to index 'comments' in candidate index.Could anybody please help me in solving this problem, I want 'comments' to be indexed and searched. as well as events table should get populated with correct data.
Thanks for looking!