Andrunevchyn

Recent Posts


Recent Comments


Archives


Categories


Meta


Andrunevchyn


db2

JPQL: self join

Assume we have following classes class Storage{ @OneToMany(mappedBy = "storage", cascade = CascadeType.ALL, targetEntity = Fruit.class, fetch = FetchType.LAZY) List fruits; } class Fruit{ String name; String owner; @ManyToOne @JoinColumn(name = "STORAGE_ID") Storage storage; } What you have to do if you would like find all storages with [...]

Andriy AndrunevchynAndriy Andrunevchyn

Hibernate: comparing dates

Lets assume we have bean MyBean with field createTime class MyBean{ public long id;  public Date createTime;  } if you execute following code MyBean bean = new MyBean();  Date time; bean.createTime = time;  //save and get with hibernate  save(bean);  MyBean storedBean = getBeanById(bean.id);  log.info("Times are equal: [...]

Andriy AndrunevchynAndriy Andrunevchyn