**
1\
**entity – bean object — project initiating needs them
init failed may caused by the attribute member
cant be find in the table.(data type )
属性对应table属性 use object save needs this, or you can’t find the revelent attribute name in table
–
-表内容 ,主键自增长
直接使用session.save(object),属性与表头不统一,报错,
you need to label the key, and its generator
see more at hibernate注解主键生成策略(https://www.cnblogs.com/ph123/p/5692194.html)
可以看出JPA提供的四种标准用法为TABLE,SEQUENCE,IDENTITY,AUTO.
TABLE:使用一个特定的数据库表格来保存主键。
SEQUENCE:根据底层数据库的序列来生成主键,条件是数据库支持序列。
IDENTITY:主键由数据库自动生成(主要是自动增长型)
AUTO:主键由程序控制。
getters and setter, toString()
**
2\
**dao – method impl
@Repository
public class RecipeDao {
@Resource
private SessionFactory sessionFactory;
//method implement here
}
**
3\
**service – cite dao as a member attribute, encase the method in dao.
@Service
public class RecipeService {
@Resource
private RecipeDao recipeDao;
//getMenu List sort{recipeName}
public Map<String ,ArrayList<Str