There are some references here and there that seem to say you can have two persistence.xml files if they have different persistence unit names. If that is so, you could keep one in src/test/resources and one in src/main/resources. Only the "main" one will go into your jar/war, whatever. Your tests though have to run against an differently named persistence unit so you use that other name when you set up things to run the tests.
I know ... its just an idea and I don't really know what I'm talking about very well. But I thought it might help you. -- Lee On Sat, Mar 26, 2011 at 8:18 AM, Rafael Vanderlei <[email protected] > wrote: > Wow... I really did not know I could put xml values on a property... > unfortunately I'm unable to test ir right now because the code is at work, > but on monday, as soon as I test it I'll post the result. > > If this works, it's gonna be enough for me. If not, I'm gonna have a look > on > OpenJPA to achieve this. > > Thanks, Wayne. > > Regards, > Rafael Vanderlei. > > On Fri, Mar 25, 2011 at 10:36 PM, Wayne Fay <[email protected]> wrote: > > > > <persistence-unit name="NAME" transaction-type="${transtype}"> > > > > > ${dbconfig} > > > > > > </persistence> > > > > Try something along these lines: > > <profile> > > <id>production</production> > > <properties> > > <transtype>JTA</transtype> > > > > > > <dbconfig><![CDATA[<jta-data-source>JNDI_NAME_FOR_MY_DATASOURCE</jta-data-source>]]</dbconfig> > > </properties> > > </profile> > > > > And yes, you'd need to put the whole <property...> section in a CDATA > > node for your unit test version. > > > > Having said all that, I think I'd look for another option. Surely > > OpenJPA would allow you to specify an alternate P-U config file so you > > could just include both and then instruct OpenJPA which one to use. > > > > Wayne > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > -- -- Lee Meador Sent from gmail. My real email address is lee AT leemeador.com
