class HibernateItemWriterBuilder<T> {

	private boolean clearSession = true;

	private SessionFactory sessionFactory;

	/**
	 * If set to false, the {@link org.hibernate.Session} will not be cleared at the end
	 * of the chunk.
	 * @param clearSession defaults to true
	 * @return this instance for method chaining
	 * @see HibernateItemWriter#setClearSession(boolean)
	 */
	public HibernateItemWriterBuilder<T> clearSession(boolean clearSession) {
		this.clearSession = clearSession;

		return this;
	}

	/**
	 * The Hibernate {@link SessionFactory} to obtain a session from. Required.
	 * @param sessionFactory the {@link SessionFactory}
	 * @return this instance for method chaining
	 * @see HibernateItemWriter#setSessionFactory(SessionFactory)
	 */
	public HibernateItemWriterBuilder<T> sessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;

		return this;
	}

	/**
	 * Returns a fully built {@link HibernateItemWriter}
	 * @return the writer
	 */
	public HibernateItemWriter<T> build() {<FILL_FUNCTION_BODY>}

}

		Assert.state(this.sessionFactory != null, "SessionFactory must be provided");

		HibernateItemWriter<T> writer = new HibernateItemWriter<>();
		writer.setSessionFactory(this.sessionFactory);
		writer.setClearSession(this.clearSession);

		return writer;
	
<no_super_class>