Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
- <hibernate-configuration>
- <session-factory>
- <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
- <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
- <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mydb</property>
- <property name="hibernate.connection.username">xxxx</property>
- <property name="hibernate.connection.password"><![CDATA[xxxx]]></property>
- <property name="hibernate.current_session_context_class">thread</property>
- <property name="hibernate.show_sql">false</property>
- <property name="hibernate.c3p0.min_size">10</property>
- <property name="hibernate.c3p0.max_size">100</property>
- <property name="hibernate.c3p0.timeout">300</property>
- <property name="hibernate.c3p0.max_statements">100</property>
- <property name="hibernate.c3p0.idle_test_period">500</property>
- <!-- Enable Hibernate's automatic session context management -->
- <property name="current_session_context_class">thread</property>
- <!-- Disable the second-level cache -->
- <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
- <!-- Echo all executed SQL to stdout -->
- <property name="show_sql">false</property>
- <!-- Drop and re-create the database schema on startup -->
- <property name="hbm2ddl.auto">validate</property>
- </session-factory>
- </hibernate-configuration>
- public String verificaLogin() throws ClassNotFoundException, SQLException, IOException {
- CrudUtenti crud = new CrudUtenti();
- ArrayList<Utenti> arrayUt = crud.SelectUtenteByMailPasswordAndAbilitato(getEmail(), password);
- if (arrayUt.size() != 1) {
- cssLogin="loginSbagliata";
- return out;
- }
- out = "success";
- //cut
- return out;
- }
- public CrudUtenti(){
- if(WgHibernateUtil.getSessionFactory().getCurrentSession() instanceof Session){
- setMainSession(WgHibernateUtil.getSessionFactory().getCurrentSession());
- }else{
- setMainSession(WgHibernateUtil.getSessionFactory().openSession());
- }
- }
- public ArrayList<Utenti> SelectUtenteByMailPasswordAndAbilitato(String email,String password){
- Transaction t;
- t = mainSession.beginTransaction();
- ArrayList<Utenti> u =(ArrayList<Utenti>) mainSession.createQuery("from Utenti u where u.em ='"+email+"' and u.pa='"+ password+ "' and abilitato = 100" ).list();
- if(t.isActive()){
- t.commit();
- }
- return u;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement