• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What we need in order to use @PersistenceContext?

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day,

I'm have limited knowledge in JPA, and would appreciated if someone can share me the understanding of how we can use @PersistenceContext, what are the file required to in place?
for instance : Persistence.xml ?

I tried google and can't get a good sample to Help my understanding, I did having a tried but the entity manager always null

P/S: using hibernate, JPA, Spring

Thanks a millions!
 
Ranch Hand
Posts: 115
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the JPA the persistence context and persistence unit have one to one relation(this is not rdbms relation) . the persistence context is used to manipulate the entities operations and persist the entities who are available in persistence context . the @PersistenceContext annotation is mostly used with JavaEE container , in which the persistence context is automatically managed by container. persistence context need the reference of persistence unit , because in the persistence unit we mention all the entities and transaction type etc . @PersistenceContext have unitName attribute to take the reference of persistence unit.
 
Singh Harmeet
Ranch Hand
Posts: 115
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Singh Harmeet wrote:in JPA the persistence context and persistence unit have one to one relation(this is not rdbms relation) . the persistence context is used to manipulate the entities operations and persist the entities who are available in persistence context . the @PersistenceContext annotation is mostly used with JavaEE container , in which the persistence context is automatically managed by container. persistence context need the reference of persistence unit , because in the persistence unit we mention all the entities and transaction type etc . @PersistenceContext have unitName attribute to take the reference of persistence unit.

 
reply
    Bookmark Topic Watch Topic
  • New Topic