001: //$Id: SQLQuery.java 10846 2006-11-18 04:21:05Z steve.ebersole@jboss.com $
002: package org.hibernate;
003:
004: import org.hibernate.type.Type;
005:
006: /**
007: * Allows the user to declare the types and select list injection
008: * points of all entities returned by the query. Also allows
009: * declaration of the type and column alias of any scalar results
010: * of the query.
011: *
012: * @author Gavin King
013: */
014: public interface SQLQuery extends Query {
015: /**
016: * Declare a "root" entity, without specifying an alias
017: */
018: public SQLQuery addEntity(String entityName);
019:
020: /**
021: * Declare a "root" entity
022: */
023: public SQLQuery addEntity(String alias, String entityName);
024:
025: /**
026: * Declare a "root" entity, specifying a lock mode
027: */
028: public SQLQuery addEntity(String alias, String entityName,
029: LockMode lockMode);
030:
031: /**
032: * Declare a "root" entity, without specifying an alias
033: */
034: public SQLQuery addEntity(Class entityClass);
035:
036: /**
037: * Declare a "root" entity
038: */
039: public SQLQuery addEntity(String alias, Class entityClass);
040:
041: /**
042: * Declare a "root" entity, specifying a lock mode
043: */
044: public SQLQuery addEntity(String alias, Class entityClass,
045: LockMode lockMode);
046:
047: /**
048: * Declare a "joined" entity
049: */
050: public SQLQuery addJoin(String alias, String path);
051:
052: /**
053: * Declare a "joined" entity, specifying a lock mode
054: */
055: public SQLQuery addJoin(String alias, String path, LockMode lockMode);
056:
057: /**
058: * Declare a scalar query result
059: */
060: public SQLQuery addScalar(String columnAlias, Type type);
061:
062: /**
063: * Declare a scalar query. Hibernate will attempt to automatically detect the underlying type.
064: */
065: public SQLQuery addScalar(String columnAlias);
066:
067: /**
068: * Use a predefined named ResultSetMapping
069: */
070: public SQLQuery setResultSetMapping(String name);
071:
072: /**
073: * Adds a query space for auto-flush synchronization.
074: *
075: * @param querySpace The query space to be auto-flushed for this query.
076: * @return this, for method chaning
077: */
078: public SQLQuery addSynchronizedQuerySpace(String querySpace);
079:
080: /**
081: * Adds an entity name or auto-flush synchronization.
082: *
083: * @param entityName The name of the entity upon whose defined
084: * query spaces we should additionally synchronize.
085: * @return this, for method chaning
086: * @throws MappingException Indicates the given entity name could not be
087: * resolved.
088: */
089: public SQLQuery addSynchronizedEntityName(String entityName)
090: throws MappingException;
091:
092: /**
093: * Adds an entity name or auto-flush synchronization.
094: *
095: * @param entityClass The class of the entity upon whose defined
096: * query spaces we should additionally synchronize.
097: * @return this, for method chaning
098: * @throws MappingException Indicates the given entity class could not be
099: * resolved.
100: */
101: public SQLQuery addSynchronizedEntityClass(Class entityClass)
102: throws MappingException;
103: }
|