2012年12月17日
摘要: hibernate对象的三种状态瞬时态(transient): 没有session管理,同时数据库中没有对应记录持久态(persistent): 有session管理,同时在数据库中有对应记录,如:save()之后,commit()之前脱管态/游离态(detached):没有session管理,但是在数据库中有记录 阅读全文
posted @ 2012-12-17 21:29 Chenyong Liu 阅读(250) 评论(0) 推荐(0)
摘要: 如何由domain中的xxx类和对应的xxx.hbm.xml,在数据库自动创建对应的表?1、配置 hibernate.cfg.xml<property name="hbm2ddl.auto">create</property>这里有四个配置值: create , update , create-drop, validatecreate: 当我们的应用程序加载hibernate.cfg.xml [ new Configuration().config(); ]就会根据映射文件,在数据库中创建对应的表,如果有,则会覆盖原表update: 如果数据库中没有 阅读全文
posted @ 2012-12-17 20:21 Chenyong Liu 阅读(2393) 评论(0) 推荐(0)