📄 improvedlocationdao.java
字号:
package com.manning.hq.ch07;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.List;
/**
* The Data Access Object for managing the persistent Locations.
*
* @author Patrick Peak
* @author Nick Heudecker
*/
public class ImprovedLocationDao extends AbstractDao {
Log log = LogFactory.getLog(ImprovedLocationDao.class);
public ImprovedLocationDao() {
super();
}
/**
* Insert a new Location into the database.
* @param location
*/
public void create(Location location) throws DataAccessLayerException {
saveOrUpdate(location);
}
/**
* Delete a detached Location from the database.
* @param location
*/
public void delete(Location location) throws DataAccessLayerException {
delete(location);
}
/**
* Find an Location by its primary key.
* @param id
* @return
*/
public Location find(Long id) throws DataAccessLayerException {
return (Location) find(Location.class, id);
}
/**
* Updates the state of a detached location.
*
* @param location
*/
public void update(Location location) throws DataAccessLayerException {
saveOrUpdate(location);
}
/**
* Finds all Locations in the database.
* @return
*/
public List findAll() throws DataAccessLayerException{
return findAll(Location.class);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -