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] Annotation 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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : dgarcia 1 package eu.smartlm.abs.portal.security.login.dao;
2 :    
3 :     import org.hibernate.SessionFactory;
4 :     import org.hibernate.cfg.AnnotationConfiguration;
5 :    
6 :     import eu.smartlm.abs.portal.security.login.model.User;
7 :    
8 :     public class Moment {
9 :    
10 :     /**
11 :     * @param args
12 :     */
13 :     public static void main(String[] args) {
14 :     SessionFactory sessionFactory = new AnnotationConfiguration()
15 :     .addAnnotatedClass(User.class)
16 :     .setProperty("hibernate.connection.driver_class","org.hsqldb.jdbcDriver")
17 :     .setProperty("hibernate.connection.url", "jdbc:hsqldb:file:/tmp/db2;shutdown=true")
18 :     .setProperty("hibernate.connection.username", "sa")
19 :     .setProperty("hibernate.connection.password", "")
20 :     .setProperty("transaction.factory_class","org.hibernate.transaction.JDBCTransactionFactory")
21 :     //.setProperty("hibernate.hbm2ddl.auto", "update")
22 :     .setProperty("hibernate.show_sql", "true")
23 :     .buildSessionFactory();
24 :    
25 :     // SessionFactory sessionFactory = new AnnotationConfiguration()
26 :     // .addAnnotatedClass(User.class)
27 :     // .setProperty("hibernate.connection.driver_class","org.postgresql.Driver")
28 :     // .setProperty("hibernate.connection.url", "jdbc:postgresql://localhost:5433/smartdb")
29 :     // .setProperty("hibernate.connection.username", "smartlmdbadmin")
30 :     // .setProperty("hibernate.connection.password", "smart#123")
31 :     //.setProperty("hibernate.hbm2ddl.auto", "update")
32 :     //.setProperty("hibernate.default_schema", "\"SmartLM\"")
33 :     // .setProperty("hibernate.show_sql", "true")
34 :     // .setProperty("hibernate.c3p0.min_size", "5")
35 :     // .setProperty("hibernate.c3p0.max_size", "20")
36 :     // .setProperty("hibernate.c3p0.timeout", "1800")
37 :     /// .setProperty("hibernate.c3p0.max_statements", "50")
38 :     // .buildSessionFactory();
39 :    
40 :    
41 :     HibernateUserDao userDao = new HibernateUserDao();
42 :     userDao.setSessionFaction(sessionFactory);
43 :    
44 :     User user1 = new User("111", "111", "111", "111", true, false);
45 :     User user2 = new User("222", "222", "222", "222", true, false);
46 :     User user3 = new User("333", "asdf", "111", "fdsa", false, true);
47 :     User user4 = new User("333ia", "asdf", "111", "fdsa", false, true);
48 :     User user5 = new User("333i", "asdf", "111", "fdsa", false, true);
49 :    
50 :    
51 :     userDao.addUser(user1);
52 :     userDao.addUser(user2);
53 :     userDao.addUser(user3);
54 :     userDao.addUser(user4);
55 :     userDao.addUser(user5);
56 :     sessionFactory.close();
57 :    
58 :     }
59 :    
60 :     }

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

Powered By FusionForge