Hi, Lee. Thanks for response. The problem with your suggestion is that I would need to maintain both files, i.e, if I need to change something (e.g. add a new entity´s orm) in the src/main/resources/persistence.xml I would need to remember doing the same changes in the src/test/resources/persistence.xml
And that´s what I am trying to avoid. But thanks for sharing your thoughts about this. Regards, Rafael Vanderlei. On Mon, Mar 28, 2011 at 12:53 AM, Lee Meador <l...@leemeador.com> wrote: > 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 < > rafaelvander...@gmail.com > > 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 <wayne...@gmail.com> 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: users-unsubscr...@maven.apache.org > > > For additional commands, e-mail: users-h...@maven.apache.org > > > > > > > > > > > > -- > -- Lee Meador > Sent from gmail. My real email address is lee AT leemeador.com >