分类目录归档:Hibernate

Hibernate增删改

package com.cstp.hibernate; import java.util.Date; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; public class UpdatetUser { public static void main(String[] args) {       //读取hibernate.cfg.xml文件    //Configuration cfg = new Configuration().configure();       //if use hibernate.propperties file ,use 2 statements … 继续阅读

发表在 Hibernate | 标签为 , , | 留下评论

Hibernate查询

大概就这5种查询方式: package com.cstp.hibernate; import java.util.List; import java.util.logging.Logger; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Restrictions; public class QueryUser { @SuppressWarnings("unchecked") public static void main(String[] args) {      Logger log = Logger.getAnonymousLogger();    … 继续阅读

发表在 Hibernate | 标签为 , | 留下评论