• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Detached /transient objects

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
can you please answer the following question .
I know hibernate will have a versioning ,if versioning is not available then
How does Hibernate distinguish between transient and detached objects?
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

karimkhan pathan wrote:hi,
can you please answer the following question .
I know hibernate will have a versioning ,if versioning is not available then
How does Hibernate distinguish between transient and detached objects?



Between/ Not sure what you mean. But any object not managed by Hibernate is detached, whether it was loaded before by Hibernate, created with the new keyword, or retreived outside Hibernate. a Transient object is one without an id set. When a transient object is attached to Hibernate Session, and has no ID, when saved Hibernate will do an insert.

Basically, versioning is unrelated to detached/transient objects.


Mark
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, versioning has nothing to do with transient or detached. Hibernate can determine by looking into the id value of the entity. If its transient id value will not be set and if its set its a detached object. Versioning will come into picture during optimistic locking where we speicy with the <version> tag.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic