public static Set<Attribute> getAll(Dimension dimension) throws ModelException { try { return HibernateHelper.get( "from Attribute a where a.dimension = ?", new Object[] {dimension}, new Type[] {Hibernate.entity(Dimension.class)}); } catch (HelperException e) { throw new ModelException(e.getMessage(), e); } }
public static Attribute getStandard(Dimension dimension, int level) throws ModelException { Set<Attribute> attributes = null; try { attributes = HibernateHelper.get( "from Attribute a where a.dimension = ? and a.standard = ? and a.level = ?", new Object[] {dimension, true, level}, new Type[] {Hibernate.entity(Dimension.class), Hibernate.BOOLEAN, Hibernate.INTEGER}); } catch (HelperException e) { throw new ModelException(e.getMessage(), e); } return attributes.size() > 0 ? attributes.iterator().next() : null; }