I have a Entity Like below
@Entity
@Table(name = "table1")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class TableOneEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "created_by")
private String createdBy;
@Column(name = "title_in_unicode")
private String titleInUnicode;
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "table1_id")
@LazyCollection(LazyCollectionOption.FALSE)
private Set<ErrorMessages> errorMessages = new HashSet<ErrorMessages>();
The Error Message Entity is like
@Entity
@Table(name = "error_messages")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ErrorMessages {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long errorId;
@Column(name = "table1_id")
private Long table1Id;
@Column(name = "field_key")
private String fieldKey;
@Column(name = "field_value")
private String fieldValue;
I am using hibernate criteria to fetch all the records from the DB;
@SuppressWarnings("unchecked")
@Override
public List listTableOneEntites()
{
Criteria criteria = getSession().createCriteria(TableOneEntity.class);
return (List) criteria.list();
}
when I printing the size of the List its giving me 417 but on doing the count * on DB on the same table the entries are 410 .
But my colleague who is running the same code in his local machine with the same dump is getting both the entries as 410.
We both are using mysql DB.
Has anyone any idea about this mismatch in count.