@Override
public GICSCodeBean getOrCreateGICSCodeBean(final String name,
final String description) {
Query query = getSession().getNamedQuery("GICSCodeBean.one");
query.setString("name", name);
GICSCodeBean gicsCode = (GICSCodeBean) query.uniqueResult();
if (gicsCode == null) {
gicsCode = persistBean(new GICSCodeBean(name, description));
} else {
if (description != null) {
if (gicsCode.getDescription() == null) {
gicsCode.setDescription(description);
getSession().saveOrUpdate(gicsCode);
getSession().flush();
}
}
}