• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Difference between detached entity and new entity JPA

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all, this is my first post here (and hope not the last) and i have a question. I'm a newbie in ORMs and i'm working on a JPA project using Hibernate implementation so i decide to look for some documentation. JAVA official site documentation about JPA is very understandable but there's something that i don't understand. I've googled about it but i couldn't find anything concret.

My question is: What's the difference between detached entity and new entity?

The next paragraph is from the java tutorial:



I understand that a new entity is when i create and instanciate a new object, for example:



But what's a detached object?

Regards.
 
author & internet detective
Posts: 40487
823
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A new entity exists in Java, but does not exist in the database. A detached entity exists in both Java and the database. It's just they don't know about changes to each other.
 
Oscar Calderon
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ohh thanks, that clears me a bunch of things about the tutorial.
 
You get good luck from rubbing the belly of a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic