| 84 | | return (ConceptComplex)sessionFactory.getCurrentSession().get(ConceptComplex.class, conceptId); |
|---|
| | 80 | ConceptComplex cc; |
|---|
| | 81 | Object obj = sessionFactory.getCurrentSession().get(ConceptComplex.class, conceptId); |
|---|
| | 82 | // If Concept has already been read & cached, we may get back a Concept instead of |
|---|
| | 83 | // ConceptComplex. If this happens, we need to clear the object from the cache |
|---|
| | 84 | // and re-fetch it as a ConceptComplex |
|---|
| | 85 | if (obj != null && !obj.getClass().equals(ConceptComplex.class)) { |
|---|
| | 86 | sessionFactory.getCurrentSession().evict(obj); // remove from cache |
|---|
| | 87 | // session.get() did not work here, we need to perform a query to get a ConceptComplex |
|---|
| | 88 | Query query = sessionFactory.getCurrentSession().createQuery("from ConceptComplex where conceptId = :conceptId") |
|---|
| | 89 | .setParameter("conceptId", conceptId); |
|---|
| | 90 | obj = query.uniqueResult(); |
|---|
| | 91 | } |
|---|
| | 92 | cc = (ConceptComplex)obj; |
|---|
| | 93 | |
|---|
| | 94 | return cc; |
|---|