retrieving data from mysql using vaadin+hibernate persistance

i am using eclipse
i have configured hibernate libraries +.cfg.xml+hbm.xml
i have created a form and bind it to pojo.
i want to authenticate users to login into sms window with username and password.
but when i click login button, no response,
message from server:
INFO: Not binding factory to JNDI, no JNDI name configured
Hibernate: select this_.userID as userID0_0_, this_.userName as userName0_0_, this_.userPassword as userPass3_0_0_, this_.secretQuestion as secretQu4_0_0_, this_.secretAnswer as secretAn5_0_0_ from account this_ where this_.userName=? and this_.userPassword=? limit ?

i need your help please…i have attach my codes…

package com.example.dawasco;

import com.vaadin.Application;
import com.vaadin.service.ApplicationContext;

public class DawascoApplication extends Application implements ApplicationContext.TransactionListener {
private static final long serialVersionUID = 1L;
private static ThreadLocal currentApplication=new ThreadLocal();

public void init() {
	setMainWindow(new LoginForm());

public void loadProtectedResource(){

	setMainWindow(new SmsWindow());

public void transactionStart ( Application application, Object o )
    if ( application == DawascoApplication.this )
        currentApplication.set ( this );

public void transactionEnd ( Application application, Object o )
    if ( application == DawascoApplication.this )
        currentApplication.set ( null );
        currentApplication.remove ();
public static DawascoApplication getInstance()
    return currentApplication.get();


my login Window:

package com.example.dawasco;

import java.util.Vector;

import org.hibernate.Criteria;

import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;

import com.example.dawasco.Login;
import com.vaadin.ui.Button;
import com.vaadin.ui.Form;
import com.vaadin.ui.HorizontalLayout;

import com.vaadin.ui.Window;
import com.vaadin.ui.Button.ClickEvent;

public class LoginForm extends Window {

private static final long serialVersionUID = 1L;
//Create a form 
private final Form form=new Form();
private final HorizontalLayout hLayout=new HorizontalLayout();
private Login user =null;

Login bean =new Login();

public LoginForm() {
	super("login to customer account");

public LoginForm(String a){

public void createForm(){
	// use FormLayout as its layout.
	form.setFormFieldFactory(new LoginFieldFactory());
	// Set form caption and description texts form
	form.setDescription("make sure you fill your username and password");
	// Create the login bean.
	// Create a bean item that is bound to the bean.
	BeanItem<Login> item = new BeanItem<Login>(bean);

	// Bind the bean item as the data source for the form. 
	// Set the order of the items in the form.
	Vector<String> order = new Vector<String>();
	Button loginButton = new Button("login", new Button.ClickListener() {
		private static final long serialVersionUID = 1L;

		public void buttonClick(ClickEvent event) {
            try {
               authenticate(bean.getUsername(), bean.getPassword());
            } catch (Exception e) {
                // Ignored, we'll let the Form handle the errors
     form.getFooter().setMargin(false, false, true, true);

public void authenticate(String username, String password) throws Exception {
 if ((user.getUsername()==username)&&(user.getPassword()==password)) {
        else {
        	throw new Exception("Login failed!");

public void dbLogin()
	Session sess = HibernateUtil.getSessionFactory().getCurrentSession();
	  Transaction newTransaction = sess.beginTransaction();
	  Criteria cri=sess.createCriteria(Login.class);
	  Criterion usernameCriteria=Restrictions.eq("username",bean.getUsername());
	  Criterion passwordCriteria=Restrictions.eq("password",bean.getPassword());
	   user = (Login)(cri.uniqueResult());


my Login.class:

  public Login(String username, String password) {
        this.username = username;
        this.password = password;
public String getId() {
	return id;

public void setId(String id) { = id;

public String getQuestion() {
	return question;

public void setQuestion(String question) {
	this.question = question;

public String getAnswer() {
	return answer;

public void setAnswer(String answer) {
	this.answer = answer;

public String getUsername() {
	return username;
public void setUsername(String username) {
	this.username = username;
public String getPassword() {
	return password;
public void setPassword(String password) {
	this.password = password;


my Login.cfg.xml

<?xml version='1.0' encoding='utf-8'?>

    <!-- Database connection settings -->
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="connection.url">jdbc:mysql://localhost:3306/dawasco</property>
    <property name="connection.username">root</property>
    <property name="connection.password"></property>
     <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>


    <!-- JDBC connection pool (use the built-in) -->
    <property name="connection.pool_size">2</property>

    <!-- SQL dialect -->
    <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</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">true</property>

    <!-- Drop and re-create the database schema on startup -->
    <!-- <property name="">update</property> -->

    <mapping resource="com/example/dawasco/Login.hbm.xml"/>

[|attachment](upload:// (1.12 KB) [|attachment](upload:// (2.13 KB) [|attachment](upload:// (5.38 KB) [|attachment](upload:// (2.54 KB) [12009.xml|attachment](upload://xbz1W22paH81X6Lu98DVgObqHN0.xml) (1.68 KB)