com.sshdemo.common.security.web.authentication.rememberme.dao.RememberMeTokenDAO.java Source code

Java tutorial

Introduction

Here is the source code for com.sshdemo.common.security.web.authentication.rememberme.dao.RememberMeTokenDAO.java

Source

/**
 * Copyright (c)2010-2011 Enterprise Website Content Management System(EWCMS), All rights reserved.
 * EWCMS PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * http://www.ewcms.com
 */

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sshdemo.common.security.web.authentication.rememberme.dao;

import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import com.sshdemo.common.dao.JpaDAO;
import com.sshdemo.common.security.web.authentication.rememberme.model.RememberMeToken;

/**
 *
 * @author wangwei
 * @author wuzhijun
 */
@Repository
public class RememberMeTokenDAO extends JpaDAO<String, RememberMeToken> {

    public void removeUserTokens(final String username) {
        String hql = "Delete From RememberMeToken o Where o.username=:username ";

        Query query = this.getEntityManager().createQuery(hql);
        query.setParameter("username", username);

        query.executeUpdate();
    }
}