• 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

Change the Persistence-Unit Properties in Runtime

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

There is a way to change the Persistence-Unit properties in runtime(via jmx)? Or pass by argument without open the persistence.xml?


example, the property hibernate.show_sql




ps. I am using JBoss.


thanks
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well it is usually a one to one relationship between a PersistenceUnit/EntityManagerFactory/Database, so when you create an EntityManagerFactory it is immutable, meaning you can't change it once it is created, and this is how it should be. If you want to point to different databases at runtime, you will need a persistence unit per database, then you might be able to write code that gets an EntityManager from one of the existing persistence units.

Mark
 
Luciano A. Pozzo
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you Mark.
 
reply
    Bookmark Topic Watch Topic
  • New Topic