| 300 | | Query query = null; |
|---|
| 301 | | List<Relationship> relationships = new Vector<Relationship>(); |
|---|
| 302 | | |
|---|
| 303 | | if (person == null) |
|---|
| 304 | | return relationships; |
|---|
| 305 | | |
|---|
| 306 | | String voided = showVoided ? "" : " and voided = 0 "; |
|---|
| 307 | | |
|---|
| 308 | | query = sessionFactory.getCurrentSession().createQuery( |
|---|
| 309 | | "from Relationship r where r.personA = :p1 or r.personB = :p2 " + voided + " order by r.relationshipId asc " |
|---|
| 310 | | ) |
|---|
| 311 | | .setParameter("p1", person) |
|---|
| 312 | | .setParameter("p2", person); |
|---|
| 313 | | |
|---|
| 314 | | if (query != null) |
|---|
| 315 | | relationships = query.list(); |
|---|
| 316 | | |
|---|
| 317 | | return relationships; |
|---|
| | 299 | |
|---|
| | 300 | Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Relationship.class, "r") |
|---|
| | 301 | .add(Expression.or(Expression.eq("personA", person), Expression.eq("personB", person))); |
|---|
| | 302 | |
|---|
| | 303 | if (!showVoided) { |
|---|
| | 304 | criteria.add(Expression.eq("voided", showVoided)); |
|---|
| | 305 | } |
|---|
| | 306 | |
|---|
| | 307 | return criteria.list(); |
|---|