import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.MySQLDialect;
import com.globallogic.volokh.beans.Authority;
import com.globallogic.volokh.beans.Contact;

/**
 * @author danylo.volokh
 * 
 *         This class is made to get Creation schema script generated by
 *         Hibernate. Need this dependency
 * 
 *         <dependency> 
 *         			<groupId>org.hibernate.common</groupId>
 *         			<artifactId>hibernate-commons-annotations</artifactId>
 *         			<version>4.0.1.Final</version> 
 *         </dependency>
 * 
 */
public class HibernateScriptCreator {

	public static void main(String[] args) {
		Configuration cfg = new Configuration();
// add classes that are models and add Dialect depends witch DB are used
		cfg.addAnnotatedClass(Authority.class);
		cfg.addAnnotatedClass(Contact.class);
		String[] lines = cfg.generateSchemaCreationScript(new MySQLDialect());

		System.out.println(lines);
		System.out.println(lines.length);
		for (int i = 0; i < lines.length; i++) {
			System.out.println(lines[i] + ";");
		}
	}

}