java吧 关注:1,260,061贴子:12,755,650
  • 7回复贴,共1

【求助hibernate】求大神给给本小白讲讲hibernate三个状态!

只看楼主收藏回复

update(obj)里面的主键一定要有么?还有hibernate主键生成策略的主键是逻辑上的,还是物理上的?


1楼2012-10-22 23:32回复
    主键一定要有么是什么意思?是问可不可以修改一个没有主键的表,还是问obj这个对象中表示主键的属性必须有值?
    关于主键生成策略,啥是逻辑上的,啥是物理上的?


    IP属地:法国2楼2012-10-23 00:10
    回复
      2025-05-18 08:38:07
      广告
      建议你看看官网文档,
      http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/
      不知道你用的是哪个版本的,这个链接是4.1最新版的。
      Entity states
      new, or transient - the entity has just been instantiated and is not associated with a persistence context. It has no persistent representation in the database and no identifier value has been assigned.
      managed, or persistent - the entity has an associated identifier and is associated with a persistence context.
      detached - the entity has an associated identifier, but is no longer associated with a persistence context (usually because the persistence context was closed or the instance was evicted from the context)
      removed - the entity has an associated identifier and is associated with a persistence context, however it is scheduled for removal from the database.


      IP属地:法国本楼含有高级字体3楼2012-10-23 06:57
      收起回复
        共学


        IP属地:四川4楼2012-10-23 16:11
        回复