Package net.sf.hibernate

Examples of net.sf.hibernate.Session.createQuery()


// Repository for files and directories
public class FileSystemImpl implements FileSystem {
    public Directory getRootDirectory() throws HibernateException {
        Session session = ThreadSession.get();
        List dirs = session.createQuery(
                "from dir in " + Directory.class + " where dir.parent is null").
                setMaxResults(1).list();
        if (dirs.iterator().hasNext()) {
            return (Directory)dirs.iterator().next();
        } else {
View Full Code Here


    public Directory getDirectory(String path) throws HibernateException {
        String[] pathElements = path.split("/");
        Directory dir = getRootDirectory();
        Session session = ThreadSession.get();
        for (int i = 1; i < pathElements.length; i++) {
            List subdirectory = session.createQuery(
                    "from dir in "+Directory.class+" where dir.parent = :parent and dir.name = :name").
                    setParameter("parent", dir, Hibernate.entity(Directory.class)).
                    setParameter("name", pathElements[i]).
                    setMaxResults(1).list();
            if (subdirectory.size() > 0) {
View Full Code Here

                            hql += " order by " + order;
                        }
                    } else {
                        hql = getBodyContent().getString();
                    }
                    Query query = session.createQuery(hql);
                    objects = bindParametersAndExecute(query);
                } else {
                    objects = new ArrayList();
                    String[] queryNames = qname.split(",");
                    for (int i = 0; i < queryNames.length; i++) {
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.