org.hibernate.tool.hbm2x.QueryExporter Maven / Gradle / Ivy
package org.hibernate.tool.hbm2x;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
/**
* exporter for query execution.
*
**/
public class QueryExporter extends AbstractExporter {
private String filename;
private List queryStrings;
@SuppressWarnings({ "unchecked" })
public void doStart() {
Session session = null;
SessionFactory sessionFactory = null;
Transaction transaction = null;
try {
sessionFactory = buildMetadata().buildSessionFactory();
session = sessionFactory.openSession();
transaction = session.beginTransaction();
for (Iterator iter = queryStrings.iterator(); iter.hasNext();) {
String query = (String) iter.next();
List