unused @Repository class will cause memory consumption
Our production application server go down very frequently and we tried analyzing the heap dump using eclipse memory analyzer tool.
Found that some char [] objects are taking more memory.
so for this issue we analyzed our application code and found that one @Repository class which was unused.
Will this unused @Repository class may cause this memory issue ?
import org.springframework.stereotype.Repository;
@Repository
public class BenchCommentDAOImpl extends BaseDAOImpl<BenchComment> implements BenchCommentDAO {
}
update 1
@Entity
@Table(name = "bnch_cmnt")
public class BenchComment extends BaseCrudEntity<Integer> implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "cmnt_id")
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "bnch_id", referencedColumnName = "bnch_id")
@JsonBackReference
private Bench bench;
@Column(name = "bnch_id" , insertable=false ,updatable=false)
private Integer benchId;
@Column(name = "xtrnl_cmnt")
private String comment;
}
@Repository class is extended from BenchComment class which is having comment as string field.
Hence in the heap dump analyzer am seeing some values with are matching with this comment field. That is where my doubt happening.
Update 2
@JsonManagedReference
@OneToMany(mappedBy="bench",cascade=CascadeType.ALL,fetch=FetchType.EAGER,orphanRemoval=true)
private List<BenchComment> benchComments;
We do have OneToMany relationship with FetchType.EAGER for BenchComment pojo class. Will this implementation cause this heap leaks issue.?