• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference between detached entity and new entity JPA

 
Oscar Calderon
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • 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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35743
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Ohh thanks, that clears me a bunch of things about the tutorial.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!