~ubuntu-branches/ubuntu/wily/libhibernate3-java/wily-proposed

« back to all changes in this revision

Viewing changes to src/org/hibernate/persister/entity/Queryable.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-10-14 14:43:34 UTC
  • Revision ID: james.westby@ubuntu.com-20071014144334-eamc8i0q10gs1aro
Tags: upstream-3.2.5
ImportĀ upstreamĀ versionĀ 3.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//$Id: Queryable.java 10825 2006-11-16 19:33:19Z steve.ebersole@jboss.com $
 
2
package org.hibernate.persister.entity;
 
3
 
 
4
/**
 
5
 * Extends the generic <tt>EntityPersister</tt> contract to add
 
6
 * operations required by the Hibernate Query Language
 
7
 *
 
8
 * @author Gavin King
 
9
 */
 
10
public interface Queryable extends Loadable, PropertyMapping, Joinable {
 
11
 
 
12
        /**
 
13
         * Is this an abstract class?
 
14
         */
 
15
        public boolean isAbstract();
 
16
        /**
 
17
         * Is this class explicit polymorphism only?
 
18
         */
 
19
        public boolean isExplicitPolymorphism();
 
20
        /**
 
21
         * Get the class that this class is mapped as a subclass of -
 
22
         * not necessarily the direct superclass
 
23
         */
 
24
        public String getMappedSuperclass();
 
25
        /**
 
26
         * Get the discriminator value for this particular concrete subclass,
 
27
         * as a string that may be embedded in a select statement
 
28
         */
 
29
        public String getDiscriminatorSQLValue();
 
30
 
 
31
        /**
 
32
         * Given a query alias and an identifying suffix, render the intentifier select fragment.
 
33
         */
 
34
        public String identifierSelectFragment(String name, String suffix);
 
35
        /**
 
36
         * Given a query alias and an identifying suffix, render the property select fragment.
 
37
         */
 
38
        public String propertySelectFragment(String alias, String suffix, boolean allProperties);
 
39
 
 
40
        /**
 
41
         * Get the names of columns used to persist the identifier
 
42
         */
 
43
        public String[] getIdentifierColumnNames();
 
44
 
 
45
        /**
 
46
         * Is the inheritence hierarchy described by this persister contained across
 
47
         * multiple tables?
 
48
         *
 
49
         * @return True if the inheritence hierarchy is spread across multiple tables; false otherwise.
 
50
         */
 
51
        public boolean isMultiTable();
 
52
 
 
53
        /**
 
54
         * Get the names of all tables used in the hierarchy (up and down) ordered such
 
55
         * that deletes in the given order would not cause contraint violations.
 
56
         *
 
57
         * @return The ordered array of table names.
 
58
         */
 
59
        public String[] getConstraintOrderedTableNameClosure();
 
60
 
 
61
        /**
 
62
         * For each table specified in {@link #getConstraintOrderedTableNameClosure()}, get
 
63
         * the columns that define the key between the various hierarchy classes.
 
64
         * <p/>
 
65
         * The first dimension here corresponds to the table indexes returned in
 
66
         * {@link #getConstraintOrderedTableNameClosure()}.
 
67
         * <p/>
 
68
         * The second dimension should have the same length across all the elements in
 
69
         * the first dimension.  If not, that'd be a problem ;)
 
70
         *
 
71
         * @return
 
72
         */
 
73
        public String[][] getContraintOrderedTableKeyColumnClosure();
 
74
 
 
75
        /**
 
76
         * Get the name of the temporary table to be used to (potentially) store id values
 
77
         * when performing bulk update/deletes.
 
78
         *
 
79
         * @return The appropriate temporary table name.
 
80
         */
 
81
        public String getTemporaryIdTableName();
 
82
 
 
83
        /**
 
84
         * Get the appropriate DDL command for generating the temporary table to
 
85
         * be used to (potentially) store id values when performing bulk update/deletes.
 
86
         *
 
87
         * @return The appropriate temporary table creation command.
 
88
         */
 
89
        public String getTemporaryIdTableDDL();
 
90
 
 
91
        /**
 
92
         * Given a property name, determine the number of the table which contains the column
 
93
         * to which this property is mapped.
 
94
         * <p/>
 
95
         * Note that this is <b>not</b> relative to the results from {@link #getConstraintOrderedTableNameClosure()}.
 
96
         * It is relative to the subclass table name closure maintained internal to the persister (yick!).
 
97
         * It is also relative to the indexing used to resolve {@link #getSubclassTableName}...
 
98
         *
 
99
         * @param propertyPath The name of the property.
 
100
         * @return The nunber of the table to which the property is mapped.
 
101
         */
 
102
        public int getSubclassPropertyTableNumber(String propertyPath);
 
103
 
 
104
        /**
 
105
         * Determine whether the given property is declared by our
 
106
         * mapped class, our super class, or one of our subclasses...
 
107
         * <p/>
 
108
         * Note: the method is called 'subclass property...' simply
 
109
         * for consistency sake (e.g. {@link #getSubclassPropertyTableNumber}
 
110
         *
 
111
         * @param propertyPath The property name.
 
112
         * @return The property declarer
 
113
         */
 
114
        public Declarer getSubclassPropertyDeclarer(String propertyPath);
 
115
 
 
116
        /**
 
117
         * Get the name of the table with the given index from the internal
 
118
         * array.
 
119
         *
 
120
         * @param number The index into the internal array.
 
121
         * @return
 
122
         */
 
123
        public String getSubclassTableName(int number);
 
124
        
 
125
        /**
 
126
         * Is the version property included in insert statements?
 
127
         */
 
128
        public boolean isVersionPropertyInsertable();
 
129
 
 
130
        /**
 
131
         * The alias used for any filter conditions (mapped where-fragments or
 
132
         * enabled-filters).
 
133
         * </p>
 
134
         * This may or may not be different from the root alias depending upon the
 
135
         * inheritence mapping strategy.
 
136
         *
 
137
         * @param rootAlias The root alias
 
138
         * @return The alias used for "filter conditions" within the where clause.
 
139
         */
 
140
        public String generateFilterConditionAlias(String rootAlias);
 
141
 
 
142
        public static class Declarer {
 
143
                public static final Declarer CLASS = new Declarer( "class" );
 
144
                public static final Declarer SUBCLASS = new Declarer( "subclass" );
 
145
                public static final Declarer SUPERCLASS = new Declarer( "superclass" );
 
146
                private final String name;
 
147
                public Declarer(String name) {
 
148
                        this.name = name;
 
149
                }
 
150
                public String toString() {
 
151
                        return name;
 
152
                }
 
153
        }
 
154
}