Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.HibernateTemplate.execute()


     * @see org.jayasoft.woj.portal.data.dao.commercial.InvoiceIdDao#getLastCreated(int)
     */
    public List getLastCreated(final int nb) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
       
        return (List)t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                        return s.createCriteria(getHandledClass())
                                .addOrder(Order.desc("creationTime"))
                                .setMaxResults(nb)
View Full Code Here


    }

    public List getAccessible(final int userPoints) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());

        return (List)t.execute(
            new HibernateCallback() {
                public Object doInHibernate(Session s) throws HibernateException, SQLException {
                    return s.createCriteria(getHandledClass()).add(Restrictions.le("neededPoints", new Integer(userPoints))).addOrder(Order.asc("neededPoints")).list();
                }
            }
View Full Code Here

    }

    public UserPoint getLast(final User u) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());

        final Long maxId = (Long)t.execute(
            new HibernateCallback() {
                public Object doInHibernate(Session s) throws HibernateException, SQLException {
                    return s.createCriteria(getHandledClass())
                    .add(Restrictions.eq("user", u))
                    .setProjection(Projections.max("id"))
View Full Code Here

                    .setProjection(Projections.max("id"))
                    .uniqueResult();
                }
            }
        );
        return (UserPoint)t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                        return s.createCriteria(getHandledClass())
                        .add(Restrictions.eq("id", maxId))
                        .uniqueResult();
View Full Code Here

    }

    public List getUserPoints(final User u) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());

        return (List)t.execute(
            new HibernateCallback() {
                public Object doInHibernate(Session s) throws HibernateException, SQLException {
                    return s.createCriteria(getHandledClass())
                    .add(Restrictions.eq("user", u))
                    .addOrder(Order.asc("id"))
View Full Code Here

     * @see org.jayasoft.woj.portal.data.dao.commercial.InvoiceIdCounterDao#perYear(int)
     */
    public InvoiceIdCounter perYear(final int year) throws DaoException {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());

        return (InvoiceIdCounter) t.execute(
            new HibernateCallback() {
                public Object doInHibernate(Session s) throws HibernateException, SQLException {
                    return s.createCriteria(getHandledClass()).add(Restrictions.eq("year", new Integer(year))).uniqueResult();
                }
            }
View Full Code Here

     */
    protected FormRowSet internalFind(final String entityName, final String tableName, final String condition, final Object[] params, final String sort, final Boolean desc, final Integer start, final Integer rows) {
        // get hibernate template
        HibernateTemplate ht = getHibernateTemplate(tableName, tableName, null, ACTION_TYPE_LOAD);

        Collection result = (Collection) ht.execute(
                new HibernateCallback() {

                    public Object doInHibernate(Session session) throws HibernateException {
                        String query = "SELECT e FROM " + tableName + " e ";
                        if (condition != null) {
View Full Code Here

     */
    protected Long internalCount(final String entityName, final String tableName, final String condition, final Object[] params) {
        // get hibernate template
        HibernateTemplate ht = getHibernateTemplate(tableName, tableName, null, ACTION_TYPE_LOAD);

        Long count = (Long) ht.execute(
                new HibernateCallback() {

                    public Object doInHibernate(Session session) throws HibernateException {
                        Query q = session.createQuery("SELECT COUNT(*) FROM " + tableName + " e " + condition);

View Full Code Here

     */
    protected String internalFindPrimaryKey(final String entityName, final String tableName, final String fieldName, final String value) {
        // get hibernate template
        HibernateTemplate ht = getHibernateTemplate(tableName, tableName, null, ACTION_TYPE_LOAD);

        String result = (String) ht.execute(
                new HibernateCallback() {

                    public Object doInHibernate(Session session) throws HibernateException {
                        String query = "SELECT e.id FROM " + tableName + " e WHERE " + FormUtil.PROPERTY_CUSTOM_PROPERTIES + "." + fieldName + " = ?";

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.