How can a persistent entity have an associated identifier but no representation in the database?









up vote
0
down vote

favorite












I was reading Hibernate user guide when I came across the definition of a managed/persistent entity. It says:




managed, or persistent



the entity has an associated identifier and is associated with a persistence context. It may or may not physically exist in the database yet.




I read somewhere else (some forum on the internet) that the difference between a detached entity and an transient is that a detached entity has an identifier associated with it which it gets from the database store when we make a representation of the entity. So if that is the case how can an entity have an associated identifier but no representation in the database if it has to first have a representation to get the identifier? Sorry if my question is not clear enough I will elaborate if you ask.










share|improve this question























  • The section of the guide you link also documents what a transient and detatched entity is. The transient description says: "It has no persistent representation in the database and typically no identifier value has been assigned (unless the assigned generator was used)".
    – Slaw
    Nov 12 at 6:36











  • An entity can have an id at the class level but no id at database level. it says "associated" identifier. the emphasis here is on the word association which I assumed it means the database level.
    – kaka
    Nov 12 at 6:53










  • A transient entity is still transient even though we assign an id annotation to one of its properties. the annotation makes no difference otherwise it would mean transient = detached. that means a managed/persistent entity with no id association in the database is a also a transient?
    – kaka
    Nov 12 at 6:58











  • An entity that has an associated identifier doesn't need to be represented in the database to get the associated identifier, think identifiers generated from sequences ...
    – tom
    Nov 12 at 15:27














up vote
0
down vote

favorite












I was reading Hibernate user guide when I came across the definition of a managed/persistent entity. It says:




managed, or persistent



the entity has an associated identifier and is associated with a persistence context. It may or may not physically exist in the database yet.




I read somewhere else (some forum on the internet) that the difference between a detached entity and an transient is that a detached entity has an identifier associated with it which it gets from the database store when we make a representation of the entity. So if that is the case how can an entity have an associated identifier but no representation in the database if it has to first have a representation to get the identifier? Sorry if my question is not clear enough I will elaborate if you ask.










share|improve this question























  • The section of the guide you link also documents what a transient and detatched entity is. The transient description says: "It has no persistent representation in the database and typically no identifier value has been assigned (unless the assigned generator was used)".
    – Slaw
    Nov 12 at 6:36











  • An entity can have an id at the class level but no id at database level. it says "associated" identifier. the emphasis here is on the word association which I assumed it means the database level.
    – kaka
    Nov 12 at 6:53










  • A transient entity is still transient even though we assign an id annotation to one of its properties. the annotation makes no difference otherwise it would mean transient = detached. that means a managed/persistent entity with no id association in the database is a also a transient?
    – kaka
    Nov 12 at 6:58











  • An entity that has an associated identifier doesn't need to be represented in the database to get the associated identifier, think identifiers generated from sequences ...
    – tom
    Nov 12 at 15:27












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I was reading Hibernate user guide when I came across the definition of a managed/persistent entity. It says:




managed, or persistent



the entity has an associated identifier and is associated with a persistence context. It may or may not physically exist in the database yet.




I read somewhere else (some forum on the internet) that the difference between a detached entity and an transient is that a detached entity has an identifier associated with it which it gets from the database store when we make a representation of the entity. So if that is the case how can an entity have an associated identifier but no representation in the database if it has to first have a representation to get the identifier? Sorry if my question is not clear enough I will elaborate if you ask.










share|improve this question















I was reading Hibernate user guide when I came across the definition of a managed/persistent entity. It says:




managed, or persistent



the entity has an associated identifier and is associated with a persistence context. It may or may not physically exist in the database yet.




I read somewhere else (some forum on the internet) that the difference between a detached entity and an transient is that a detached entity has an identifier associated with it which it gets from the database store when we make a representation of the entity. So if that is the case how can an entity have an associated identifier but no representation in the database if it has to first have a representation to get the identifier? Sorry if my question is not clear enough I will elaborate if you ask.







java hibernate jpa entity persistent






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 6:28









Slaw

6,1242830




6,1242830










asked Nov 12 at 6:19









kaka

85228




85228











  • The section of the guide you link also documents what a transient and detatched entity is. The transient description says: "It has no persistent representation in the database and typically no identifier value has been assigned (unless the assigned generator was used)".
    – Slaw
    Nov 12 at 6:36











  • An entity can have an id at the class level but no id at database level. it says "associated" identifier. the emphasis here is on the word association which I assumed it means the database level.
    – kaka
    Nov 12 at 6:53










  • A transient entity is still transient even though we assign an id annotation to one of its properties. the annotation makes no difference otherwise it would mean transient = detached. that means a managed/persistent entity with no id association in the database is a also a transient?
    – kaka
    Nov 12 at 6:58











  • An entity that has an associated identifier doesn't need to be represented in the database to get the associated identifier, think identifiers generated from sequences ...
    – tom
    Nov 12 at 15:27
















  • The section of the guide you link also documents what a transient and detatched entity is. The transient description says: "It has no persistent representation in the database and typically no identifier value has been assigned (unless the assigned generator was used)".
    – Slaw
    Nov 12 at 6:36











  • An entity can have an id at the class level but no id at database level. it says "associated" identifier. the emphasis here is on the word association which I assumed it means the database level.
    – kaka
    Nov 12 at 6:53










  • A transient entity is still transient even though we assign an id annotation to one of its properties. the annotation makes no difference otherwise it would mean transient = detached. that means a managed/persistent entity with no id association in the database is a also a transient?
    – kaka
    Nov 12 at 6:58











  • An entity that has an associated identifier doesn't need to be represented in the database to get the associated identifier, think identifiers generated from sequences ...
    – tom
    Nov 12 at 15:27















The section of the guide you link also documents what a transient and detatched entity is. The transient description says: "It has no persistent representation in the database and typically no identifier value has been assigned (unless the assigned generator was used)".
– Slaw
Nov 12 at 6:36





The section of the guide you link also documents what a transient and detatched entity is. The transient description says: "It has no persistent representation in the database and typically no identifier value has been assigned (unless the assigned generator was used)".
– Slaw
Nov 12 at 6:36













An entity can have an id at the class level but no id at database level. it says "associated" identifier. the emphasis here is on the word association which I assumed it means the database level.
– kaka
Nov 12 at 6:53




An entity can have an id at the class level but no id at database level. it says "associated" identifier. the emphasis here is on the word association which I assumed it means the database level.
– kaka
Nov 12 at 6:53












A transient entity is still transient even though we assign an id annotation to one of its properties. the annotation makes no difference otherwise it would mean transient = detached. that means a managed/persistent entity with no id association in the database is a also a transient?
– kaka
Nov 12 at 6:58





A transient entity is still transient even though we assign an id annotation to one of its properties. the annotation makes no difference otherwise it would mean transient = detached. that means a managed/persistent entity with no id association in the database is a also a transient?
– kaka
Nov 12 at 6:58













An entity that has an associated identifier doesn't need to be represented in the database to get the associated identifier, think identifiers generated from sequences ...
– tom
Nov 12 at 15:27




An entity that has an associated identifier doesn't need to be represented in the database to get the associated identifier, think identifiers generated from sequences ...
– tom
Nov 12 at 15:27

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256806%2fhow-can-a-persistent-entity-have-an-associated-identifier-but-no-representation%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256806%2fhow-can-a-persistent-entity-have-an-associated-identifier-but-no-representation%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線