Package com.lissenberg.blog.domain

Examples of com.lissenberg.blog.domain.Statistics


     * @return updated statistics
     */
    public Statistics updateStatistics(Long blogId, RequestInfo requestInfo) {
        Date now = new Date();
        entityManager.persist(requestInfo);
        Statistics statistics = entityManager.find(Statistics.class, blogId);
        if (statistics == null) {
            statistics = new Statistics();
            statistics.setBlogId(blogId);
            statistics.setFirstVisit(now);
            statistics.setLastVisit(now);
            statistics.setHits(1);
            entityManager.persist(statistics);
        } else {
            statistics.setLastVisit(now);
            statistics.addHit();
            entityManager.merge(statistics);
        }
        entityManager.flush();
        entityManager.detach(statistics);
        entityManager.detach(requestInfo);
View Full Code Here

TOP

Related Classes of com.lissenberg.blog.domain.Statistics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.