org.hibernate.cfg.AnnotationConfiguration Java Examples

The following examples show how to use org.hibernate.cfg.AnnotationConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HibernateUtil.java    From maven-framework-project with MIT License 5 votes vote down vote up
private static SessionFactory buildSessionFactory() {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        return new AnnotationConfiguration()
        		.configure()
                .buildSessionFactory();
    } catch (Throwable ex) {
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
 
Example #2
Source File: HibernateUtil.java    From maven-framework-project with MIT License 5 votes vote down vote up
private static SessionFactory buildSessionFactory() {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        return new AnnotationConfiguration()
        		.configure()
                .buildSessionFactory();
    } catch (Throwable ex) {
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
 
Example #3
Source File: HibernateUtil.java    From maven-framework-project with MIT License 5 votes vote down vote up
private static SessionFactory buildSessionFactory() {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        return new AnnotationConfiguration()
        		.configure()
                .buildSessionFactory();
    } catch (Throwable ex) {
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
 
Example #4
Source File: HibernateUtil.java    From maven-framework-project with MIT License 5 votes vote down vote up
private static SessionFactory buildSessionFactory() {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        return new AnnotationConfiguration()
        		.configure()
                .buildSessionFactory();
    } catch (Throwable ex) {
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
 
Example #5
Source File: HibernateUtil.java    From maven-framework-project with MIT License 5 votes vote down vote up
private static SessionFactory buildSessionFactory() {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        return new AnnotationConfiguration()
        		.configure()
                .buildSessionFactory();
    } catch (Throwable ex) {
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
 
Example #6
Source File: HibernateUtil.java    From maven-framework-project with MIT License 5 votes vote down vote up
private static SessionFactory buildSessionFactory() {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        return new AnnotationConfiguration()
        		.configure()
                .buildSessionFactory();
    } catch (Throwable ex) {
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
 
Example #7
Source File: HibernateUtil.java    From maven-framework-project with MIT License 5 votes vote down vote up
private static SessionFactory buildSessionFactory() {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        return new AnnotationConfiguration()
        		.configure()
                .buildSessionFactory();
    } catch (Throwable ex) {
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
 
Example #8
Source File: HibernateUtil.java    From maven-framework-project with MIT License 5 votes vote down vote up
private static SessionFactory buildSessionFactory() {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        return new AnnotationConfiguration()
        		.configure()
                .buildSessionFactory();
    } catch (Throwable ex) {
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
 
Example #9
Source File: HibernateUtil.java    From maven-framework-project with MIT License 5 votes vote down vote up
private static SessionFactory buildSessionFactory() {
    try {
        // Create the SessionFactory from hibernate.cfg.xml
        return new AnnotationConfiguration()
        		.configure()
                .buildSessionFactory();
    } catch (Throwable ex) {
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
 
Example #10
Source File: HibernateUtil.java    From maven-framework-project with MIT License 5 votes vote down vote up
private static SessionFactory buildSessionFactory() {
	try {
		// Create the SessionFactory from hibernate.cfg.xml
		return new AnnotationConfiguration().configure()
				.buildSessionFactory();

	} catch (Throwable ex) {
		System.err.println("Initial SessionFactory creation failed." + ex);
		throw new ExceptionInInitializerError(ex);
	}
}
 
Example #11
Source File: SQLiteDictionary.java    From poli-libras with GNU General Public License v3.0 5 votes vote down vote up
public SQLiteDictionary(){
	
	Configuration configSqlite = new AnnotationConfiguration().setProperty("hibernate.connection.url", DATABASE_URL);
	SessionFactory sessions = configSqlite.configure().buildSessionFactory();
	Session session = sessions.openSession();        
       SignDaoFactory<Sign> factory = new SignDaoFactory<Sign>(session);
       this.dao = factory.getSignDao();

}
 
Example #12
Source File: AnnotationSessionFactoryBeanEx.java    From JgFramework with Apache License 2.0 5 votes vote down vote up
/**
 * @see AnnotationSessionFactoryBean#postProcessAnnotationConfiguration(org.hibernate.cfg.AnnotationConfiguration)
 */
@Override
protected void postProcessAnnotationConfiguration(
        AnnotationConfiguration config) throws HibernateException {
    Set<Class<?>> annClasses = scanAnnotatedClasses(); // Scan enity
    // classes.
    // Add entity classes to the configuration.
    if (!CollectionUtils.isEmpty(annClasses)) {
        for (Class<?> annClass : annClasses) {
            config.addAnnotatedClass(annClass);
        }
    }
}
 
Example #13
Source File: HibernateDatabase.java    From livingdoc-core with GNU General Public License v3.0 4 votes vote down vote up
public HibernateDatabase(Properties properties) throws HibernateException {
    cfg = new AnnotationConfiguration();
    cfg.setProperties(properties);
    setAnnotadedClasses();
    loadConfig();
}
 
Example #14
Source File: HibernateSimple.java    From java-course-ee with MIT License 4 votes vote down vote up
private SessionFactory getSessionFactory() {
    return new AnnotationConfiguration().configure().buildSessionFactory();
}