All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.greenpepper.server.domain.dao.hibernate.HibernateSystemInfoDao Maven / Gradle / Ivy

There is a newer version: 4.2.4
Show newest version
package com.greenpepper.server.domain.dao.hibernate;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Property;

import com.greenpepper.server.database.SessionService;
import com.greenpepper.server.domain.SystemInfo;
import com.greenpepper.server.domain.dao.SystemInfoDao;

/**
 * 

HibernateSystemInfoDao class.

* * @author oaouattara * @version $Id: $Id */ public class HibernateSystemInfoDao implements SystemInfoDao { private static final long SYSTEM_INFO = 1l; private SessionService sessionService; /** *

Constructor for HibernateSystemInfoDao.

* * @param sessionService a {@link com.greenpepper.server.database.SessionService} object. */ public HibernateSystemInfoDao(SessionService sessionService) { this.sessionService = sessionService; } /** *

getSystemInfo.

* * @return a {@link com.greenpepper.server.domain.SystemInfo} object. */ public SystemInfo getSystemInfo() { final Criteria crit = sessionService.getSession().createCriteria(SystemInfo.class); crit.add(Property.forName("id").eq(SYSTEM_INFO)); SystemInfo systemInfo = (SystemInfo) crit.uniqueResult(); // crit.addOrder(Order.desc("id")); // List list = crit.list(); // SystemInfo systemInfo = null; // if (list.size() > 0) { // systemInfo = (SystemInfo) list.get(0); // } HibernateLazyInitializer.init(systemInfo); return systemInfo; } /** {@inheritDoc} */ public void store(SystemInfo systemInfo) { sessionService.getSession().saveOrUpdate(systemInfo); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy