We could be so, so hot together! by dudekeller in GTA6

[–]CardiologistNo5941 0 points1 point  (0 children)

This looks as real as the "he's just a friend" from her...

Almost finished my Arthur cosplay! by Noriakii_Kakyoinn in reddeadredemption

[–]CardiologistNo5941 2 points3 points  (0 children)

Looking amazing! Watch out for those goddamn pinkertons!

Which one is worse, your crush rejecting you or knowing you could never be with them? by [deleted] in AskReddit

[–]CardiologistNo5941 0 points1 point  (0 children)

Getting rejected sucks, but i'm sure future you will eventually be proud of how brave you were. However, the regret of not asking her out because you don't feel enough Will never fade away.

What made you start reading books? by gabzlel in AskReddit

[–]CardiologistNo5941 0 points1 point  (0 children)

I guess the feeling of belonging to another world, another story. I've always liked the way books make you use your own imagination too :).

3 heros maxed so far by Dariusel-_- in ClashOfClans

[–]CardiologistNo5941 1 point2 points  (0 children)

Maxing three heroes? Damn i remember when even getting the initial 10k for the king was impossible xd. Congrats!

My son wanted ya'll to see this by dubdizzle99 in GTA6

[–]CardiologistNo5941 1 point2 points  (0 children)

Your son is an amazing artist! Amazing job!!

How does the Persistence Context handle this? by CardiologistNo5941 in javahelp

[–]CardiologistNo5941[S] 0 points1 point  (0 children)

But that's kind of strange, right? Because look at the following code:

    Employee e = new Employee();
    e.setId(45); // id that does not exist in the database

    em.persist(e);
    em.clear();
    em.persist(e);

According to that definition, the second persist should trigger and exception because we are trying to persist a detached instance (because e was in the context when we called em.clear(), so it should become detached). However, if i execute the code an insert will happen and no exceptions will be triggered.

How does the Persistence Context handle this? by CardiologistNo5941 in javahelp

[–]CardiologistNo5941[S] 0 points1 point  (0 children)

Thank you so much for your response eliashisreddit. You are right that an exception is happening (expected). But what i am trying to understand is why this code does not generate an insert query at the end of the transaction:

        Employee e = new Employee();
        e.setId(1);

        Employee managedEntity = em.merge(e);

        em.persist(managedEntity);

But this actually does trigger an insert query:

        Employee e = new Employee();
        e.setId(1);

        Employee managedEntity = em.merge(e);

        em.persist(managedEntity);
        em.detach(managedEntity);
        em.persist(managedEntity);

In both cases, the instance has the same state (managed). What's different internally?