view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RiverFactory.java @ 308:084995dd1c9c

Added a session holder to hold hibernate sessions. flys-artifacts/trunk@1689 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 14 Apr 2011 12:08:47 +0000
parents e8dfe6ba2000
children ea3a438a7021
line wrap: on
line source
package de.intevation.flys.artifacts.model;


import java.util.List;

import de.intevation.flys.model.River;

import de.intevation.flys.backend.SessionFactoryProvider;

import org.hibernate.SessionFactory;
import org.hibernate.Session;

/**
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class RiverFactory {

    /** We don't need to instantiate concrete objects of this class. */
    private RiverFactory() {
    }


    /**
     * Returns all rivers that were found in the backend.
     *
     * @return all rivers.
     */
    public static List<River> getRivers() {
        Session session = SessionHolder.HOLDER.get();
        return (List<River>)session
            .createQuery("from River order by name").list();
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org