How to override persistence.xml properties in OpenJPA?

OpenJPA doesn't look at SystemProperties by default when creating an EM/EMF. Try passing in System.getProperties() in when creating your EMF.

OpenJPA doesn't look at SystemProperties by default when creating an EM/EMF. Try passing in System.getProperties() in when creating your EMF. Persistence.

CreateEntityManagerFactory("pu_Name", System.getProperties()).

You can pass properties to the EntityManagerFactory and override persistence. Xml that way.

Basically, yes, you have to pass in all the sys properties explicitly, it seems they are not read by default. – Joel May 2 at 14:38 Thanks Joseph.. – Joel May 2 at 15:50.

I'm afraid you're out of luck. The manual says In JPA, the values in the standard META-INF/persistence. Xml bootstrapping file used by the Persistence class at runtime override the values in the above resource openjpa.

Xml, as well as any System property settings. I don't know why it's like that, but it's like that. However, it's also true that: The Map passed to Persistence.

CreateEntityManagerFactory at runtime also overrides previous settings, including properties defined in persistence.xml. So if you can get your settings in there, you're good.

Thanks Tom..... – Joel May 2 at 15:50 Not at all. You're a very polite chap! – Tom Anderson May 2 at 16:15 1 It's probably the sun going to my head.

– Joel May 3 at 11:14.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions