Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
244 views
in Technique[技术] by (71.8m points)

java - @PersistenceContext(type = PersistenceContextType.EXTENDED) private EntityManager entityManager;

To tell EntityManager to use extended-scoped persistence context, we need to apply the type attribute of @PersistenceContext:

@PersistenceContext(type = PersistenceContextType.EXTENDED)
private EntityManager entityManager;

private EntityManager entityManager; In the stateless session bean, the extended persistence context in one component is completely unaware of any persistence context of another component. This is true even if both are in same the same transaction.

Let's say we persist some entity in a method of Component A, which is running in a transaction. We then call some method of Component B. In Component B's method persistence context, we will not find the entity we persisted previously in the method of Component A.

Question:

can you explain the last paragraph to me, or give an example code

question from:https://stackoverflow.com/questions/65949842/persistencecontexttype-persistencecontexttype-extended-private-entitymanage

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...