hibernateoperations.java

来自「spring的源代码」· Java 代码 · 共 473 行 · 第 1/2 页

JAVA
473
字号
	/**
	 * Delete all given persistent instances.
	 * This can be combined with any of the find methods to delete by query
	 * in two lines of code, similar to Session's delete by query methods.
	 * @param entities the persistent instances to delete
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#delete(String)
	 */
	void deleteAll(final Collection entities) throws DataAccessException;


	//-------------------------------------------------------------------------
	// Convenience finder methods
	//-------------------------------------------------------------------------

	/**
	 * Execute a query for persistent instances.
	 * @param queryString a query expressed in Hibernate's query language
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#createQuery
	 */
	List find(final String queryString) throws DataAccessException;

	/**
	 * Execute a query for persistent instances, binding
	 * one value to a "?" parameter in the query string.
	 * @param queryString a query expressed in Hibernate's query language
	 * @param value the value of the parameter
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#createQuery
	 */
	List find(final String queryString, final Object value) throws DataAccessException;

	/**
	 * Execute a query for persistent instances, binding one value
	 * to a "?" parameter of the given type in the query string.
	 * @param queryString a query expressed in Hibernate's query language
	 * @param value the value of the parameter
	 * @param type Hibernate type of the parameter
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#createQuery
	 */
	List find(final String queryString, final Object value, final Type type)
			throws DataAccessException;

	/**
	 * Execute a query for persistent instances, binding a
	 * number of values to "?" parameters in the query string.
	 * @param queryString a query expressed in Hibernate's query language
	 * @param values the values of the parameters
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#createQuery
	 */
	List find(final String queryString, final Object[] values) throws DataAccessException;

	/**
	 * Execute a query for persistent instances, binding a number of
	 * values to "?" parameters of the given types in the query string.
	 * @param queryString a query expressed in Hibernate's query language
	 * @param values the values of the parameters
	 * @param types Hibernate types of the parameters
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#createQuery
	 */
	List find(final String queryString, final Object[] values, final Type[] types)
			throws DataAccessException;

	/**
	 * Execute a query for persistent instances, binding the properties
	 * of the given bean to <i>named</i> parameters in the query string.
	 * @param queryString a query expressed in Hibernate's query language
	 * @param valueBean the values of the parameters
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#createQuery
	 * @see net.sf.hibernate.Query#setProperties
	 */
	List findByValueBean(final String queryString, final Object valueBean)
			throws DataAccessException;

	/**
	 * Execute a named query for persistent instances.
	 * A named query is defined in a Hibernate mapping file.
	 * @param queryName the name of a Hibernate query in a mapping file
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#getNamedQuery(String)
	 */
	List findByNamedQuery(final String queryName) throws DataAccessException;

	/**
	 * Execute a named query for persistent instances, binding
	 * one value to a "?" parameter in the query string.
	 * A named query is defined in a Hibernate mapping file.
	 * @param queryName the name of a Hibernate query in a mapping file
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#getNamedQuery(String)
	 */
	List findByNamedQuery(final String queryName, final Object value)
			throws DataAccessException;

	/**
	 * Execute a named query for persistent instances, binding
	 * one value to a "?" parameter in the query string.
	 * A named query is defined in a Hibernate mapping file.
	 * @param queryName the name of a Hibernate query in a mapping file
	 * @param type Hibernate type of the parameter
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#getNamedQuery(String)
	 */
	List findByNamedQuery(final String queryName, final Object value, final Type type)
			throws DataAccessException;

	/**
	 * Execute a named query for persistent instances, binding a
	 * number of values to "?" parameters in the query string.
	 * A named query is defined in a Hibernate mapping file.
	 * @param queryName the name of a Hibernate query in a mapping file
	 * @param values the values of the parameters
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#getNamedQuery(String)
	 */
	List findByNamedQuery(final String queryName, final Object[] values)
			throws DataAccessException;

	/**
	 * Execute a named query for persistent instances, binding a
	 * number of values to "?" parameters in the query string.
	 * A named query is defined in a Hibernate mapping file.
	 * @param queryName the name of a Hibernate query in a mapping file
	 * @param values the values of the parameters
	 * @param types Hibernate types of the parameters
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#getNamedQuery(String)
	 */
	List findByNamedQuery(final String queryName, final Object[] values, final Type[] types)
			throws DataAccessException;

	/**
	* Execute a named query for persistent instances, binding
	* one value to a ":" named parameter in the query string.
	* A named query is defined in a Hibernate mapping file.
	* @param queryName the name of a Hibernate query in a mapping file
	* @param paramName the name of parameter
	* @param value the value of the parameter
	* @return a List containing 0 or more persistent instances
	* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	* @see net.sf.hibernate.Session#find(String)
	* @see net.sf.hibernate.Session#getNamedQuery(String)
	*/
	List findByNamedQuery(final String queryName, final String paramName, final Object value)
			throws DataAccessException;

	/**
	* Execute a named query for persistent instances, binding
	* one value to a ":" named parameter in the query string.
	* A named query is defined in a Hibernate mapping file.
	* @param queryName the name of a Hibernate query in a mapping file
	* @param paramName the name of the parameter
	* @param value the value of the parameter
	* @param type Hibernate type of the parameter
	* @return a List containing 0 or more persistent instances
	* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	* @see net.sf.hibernate.Session#find(String)
	* @see net.sf.hibernate.Session#getNamedQuery(String)
	*/
	List findByNamedQuery(final String queryName, final String paramName, final Object value, final Type type)
			throws DataAccessException;

	/**
	* Execute a named query for persistent instances, binding a
	* number of values to ":" named parameters in the query string.
	* A named query is defined in a Hibernate mapping file.
	* @param queryName the name of a Hibernate query in a mapping file
	* @param paramNames the names of the parameters
	* @param values the values of the parameters
	* @return a List containing 0 or more persistent instances
	* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	* @see net.sf.hibernate.Session#find(String)
	* @see net.sf.hibernate.Session#getNamedQuery(String)
	*/
	List findByNamedQuery(final String queryName, final String[] paramNames, final Object[] values)
			throws DataAccessException;

	/**
	* Execute a named query for persistent instances, binding a
	* number of values to ":" named parameters in the query string.
	* A named query is defined in a Hibernate mapping file.
	* @param queryName the name of a Hibernate query in a mapping file
	* @param paramNames the names of the parameters
	* @param values the values of the parameters
	* @param types Hibernate types of the parameters
	* @return a List containing 0 or more persistent instances
	* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	* @see net.sf.hibernate.Session#find(String)
	* @see net.sf.hibernate.Session#getNamedQuery(String)
	*/
	List findByNamedQuery(final String queryName, final String[] paramNames, final Object[] values, final Type[] types)
			throws DataAccessException;
	/**
	 * Execute a named query for persistent instances, binding the properties
	 * of the given bean to ":" named parameters in the query string.
	 * A named query is defined in a Hibernate mapping file.
	 * @param queryName the name of a Hibernate query in a mapping file
	 * @param valueBean the values of the parameters
	 * @return a List containing 0 or more persistent instances
	 * @throws org.springframework.dao.DataAccessException in case of Hibernate errors
	 * @see net.sf.hibernate.Session#find(String)
	 * @see net.sf.hibernate.Session#getNamedQuery(String)
	 * @see net.sf.hibernate.Query#setProperties
	 */
	List findByNamedQueryAndValueBean(final String queryName, final Object valueBean)
			throws DataAccessException;

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?