There is a method called contains() that we can invoke on an Entity to check if that entity is available in the PersistenceContext. Likewise is there any way to attach an entity to a PersistenceContext apart from operating it using the entity operations like find() and getReference()?
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
The merge method is used (also) to attach an entity to context.
I think the answer to your question is no, there is nothing like attach method - there are a lot of tricks bue each one has pros and contras.
SCJP, SCJD, SCWCD, OCPJBCD
posted 6 years ago
There are 3 methods mainly that attach an entity(when an entity becomes managed).
Hope this helps answer your query!
SCBCD5, SCWCD5, SCJP5
"Even if you're on the right track, you'll get run over if you just sit there."