Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt regarding extended persistent context

 
krishna bulusu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If we obtain the EntityManager from EntityMangerFacory, then the persistent context is by default Extended.
So, we can use this technique only in stateful session beans not in MDB or stateless session beans. Am I right?
 
Nitin Takale
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes krishna you are right in saying that.

But you can also inject persistence context in stateful session bean using
@PersistenceContext annotation.

You can specify which kind of persistence context you want e.g. Transaction scoped or extended by specifying the same in...type property of the annotation.
e.g.

@PersistenceContext(type="extended")
EntityManager mgr;

That's one more way of doing it.

bye

nitin
 
Nitin Takale
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nitin Takale:
Yes krishna you are right in saying that.

But you can also inject persistence context in stateful session bean using
@PersistenceContext annotation.

You can specify which kind of persistence context you want e.g. Transaction scoped or extended by specifying the same in...type property of the annotation.
e.g.

@PersistenceContext(type="extended")
EntityManager mgr;

That's one more way of doing it.

bye

 
Nitin Takale
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nitin Takale:
[QB]Yes krishna you are right in saying that.

But you can also inject persistence context in stateful session bean using
@PersistenceContext annotation.

You can specify which kind of persistence context you want e.g. Transaction scoped or extended by specifying the same in...type property of the annotation.
e.g.

@PersistenceContext(type="extended")
EntityManager mgr;

That's one more way of doing it.

bye
 
Nitin Takale
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry guys for this multiple replies from my side... It happened because of improper network connectivity at my side.

I hope you will understand.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic