Subversion Repositories WebE

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
33 PointedEar 1
/*
2
 * Hibernate, Relational Persistence for Idiomatic Java
3
 *
4
 * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
5
 * indicated by the @author tags or express copyright attribution
6
 * statements applied by the authors.  All third-party contributions are
7
 * distributed under license by Red Hat Middleware LLC.
8
 *
9
 * This copyrighted material is made available to anyone wishing to use, modify,
10
 * copy, or redistribute it subject to the terms and conditions of the GNU
11
 * Lesser General Public License, as published by the Free Software Foundation.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
16
 * for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public License
19
 * along with this distribution; if not, write to:
20
 * Free Software Foundation, Inc.
21
 * 51 Franklin Street, Fifth Floor
22
 * Boston, MA  02110-1301  USA
23
 *
24
 */
25
package org.hibernate;
26
 
27
import org.hibernate.type.Type;
28
 
29
/**
30
 * Allows the user to declare the types and select list injection
31
 * points of all entities returned by the query. Also allows
32
 * declaration of the type and column alias of any scalar results
33
 * of the query.
34
 *
35
 * @author Gavin King
36
 */
37
public interface SQLQuery extends Query {
38
        /**
39
         * Declare a "root" entity, without specifying an alias
40
         */
41
        public SQLQuery addEntity(String entityName);
42
        /**
43
         * Declare a "root" entity
44
         */
45
        public SQLQuery addEntity(String alias, String entityName);
46
        /**
47
         * Declare a "root" entity, specifying a lock mode
48
         */
49
        public SQLQuery addEntity(String alias, String entityName, LockMode lockMode);
50
        /**
51
         * Declare a "root" entity, without specifying an alias
52
         */
53
        public SQLQuery addEntity(Class entityClass);
54
        /**
55
         * Declare a "root" entity
56
         */
57
        public SQLQuery addEntity(String alias, Class entityClass);
58
        /**
59
         * Declare a "root" entity, specifying a lock mode
60
         */
61
        public SQLQuery addEntity(String alias, Class entityClass, LockMode lockMode);
62
 
63
        /**
64
         * Declare a "joined" entity
65
         */
66
        public SQLQuery addJoin(String alias, String path);
67
        /**
68
         * Declare a "joined" entity, specifying a lock mode
69
         */
70
        public SQLQuery addJoin(String alias, String path, LockMode lockMode);
71
 
72
        /**
73
         * Declare a scalar query result
74
         */
75
        public SQLQuery addScalar(String columnAlias, Type type);
76
 
77
        /**
78
         * Declare a scalar query. Hibernate will attempt to automatically detect the underlying type.
79
         */
80
        public SQLQuery addScalar(String columnAlias);
81
 
82
        /**
83
         * Use a predefined named ResultSetMapping
84
         */
85
        public SQLQuery setResultSetMapping(String name);
86
 
87
        /**
88
         * Adds a query space for auto-flush synchronization.
89
         *
90
         * @param querySpace The query space to be auto-flushed for this query.
91
         * @return this, for method chaning
92
         */
93
        public SQLQuery addSynchronizedQuerySpace(String querySpace);
94
 
95
        /**
96
         * Adds an entity name or auto-flush synchronization.
97
         *
98
         * @param entityName The name of the entity upon whose defined
99
         * query spaces we should additionally synchronize.
100
         * @return this, for method chaning
101
         * @throws MappingException Indicates the given entity name could not be
102
         * resolved.
103
         */
104
        public SQLQuery addSynchronizedEntityName(String entityName) throws MappingException;
105
 
106
        /**
107
         * Adds an entity name or auto-flush synchronization.
108
         *
109
         * @param entityClass The class of the entity upon whose defined
110
         * query spaces we should additionally synchronize.
111
         * @return this, for method chaning
112
         * @throws MappingException Indicates the given entity class could not be
113
         * resolved.
114
         */
115
        public SQLQuery addSynchronizedEntityClass(Class entityClass) throws MappingException;
116
}