Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Accounting and Billing Portal
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[abportal] View of /src/main/java/eu/smartlm/abs/portal/security/login/dao/Moment.java
[abportal] / src / main / java / eu / smartlm / abs / portal / security / login / dao / Moment.java Repository:
ViewVC logotype

View of /src/main/java/eu/smartlm/abs/portal/security/login/dao/Moment.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (download) (annotate)
Wed Jul 28 10:05:51 2010 UTC (13 years, 9 months ago) by dgarcia
File size: 2455 byte(s)
First code commit
package eu.smartlm.abs.portal.security.login.dao;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import eu.smartlm.abs.portal.security.login.model.User;

public class Moment {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		SessionFactory sessionFactory = new AnnotationConfiguration()
			.addAnnotatedClass(User.class)
			.setProperty("hibernate.connection.driver_class","org.hsqldb.jdbcDriver")
			.setProperty("hibernate.connection.url", "jdbc:hsqldb:file:/tmp/db2;shutdown=true")
			.setProperty("hibernate.connection.username", "sa")
			.setProperty("hibernate.connection.password", "")
			.setProperty("transaction.factory_class","org.hibernate.transaction.JDBCTransactionFactory")
			//.setProperty("hibernate.hbm2ddl.auto", "update")
			.setProperty("hibernate.show_sql", "true")
			.buildSessionFactory();

//              SessionFactory sessionFactory = new AnnotationConfiguration()
//              .addAnnotatedClass(User.class)
//              .setProperty("hibernate.connection.driver_class","org.postgresql.Driver")
//              .setProperty("hibernate.connection.url", "jdbc:postgresql://localhost:5433/smartdb")
//              .setProperty("hibernate.connection.username", "smartlmdbadmin")
//              .setProperty("hibernate.connection.password", "smart#123")
              //.setProperty("hibernate.hbm2ddl.auto", "update")
              //.setProperty("hibernate.default_schema", "\"SmartLM\"")
//              .setProperty("hibernate.show_sql", "true")
//             .setProperty("hibernate.c3p0.min_size", "5")
//              .setProperty("hibernate.c3p0.max_size", "20")
//              .setProperty("hibernate.c3p0.timeout", "1800")
///              .setProperty("hibernate.c3p0.max_statements", "50")
//              .buildSessionFactory();

		
		HibernateUserDao userDao = new HibernateUserDao();
		userDao.setSessionFaction(sessionFactory);
		
		User user1 = new User("111", "111", "111", "111", true, false);
		User user2 = new User("222", "222", "222", "222", true, false);
		User user3 = new User("333", "asdf", "111", "fdsa", false, true);
		User user4 = new User("333ia", "asdf", "111", "fdsa", false, true);
		User user5 = new User("333i", "asdf", "111", "fdsa", false, true);
		
		
		userDao.addUser(user1);
		userDao.addUser(user2);
		userDao.addUser(user3);
		userDao.addUser(user4);
		userDao.addUser(user5);
		sessionFactory.close();

	}

}

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge