You should read more about Profiles on the Maven website and in the
free PDF books from Mergere and Sonatype, and then do some more
exploring on your own.

Property substitution happens "automatically" by Maven at
compile/package time (its static) -- nothing happens at runtime (not
dynamic) -- so you do run into the issue of "this Jar was packaged for
DEV, this one for PROD" which many people dislike.

So keep playing and reading with it, and bounce back over here with
more questions as you have them.

Wayne

On 7/13/07, Ryan Moquin <[EMAIL PROTECTED]> wrote:
Hi Tim,

Thanks for your response... I was having trouble getting the first scenario
to work, but that's because I took an approach of specifying two
configurations in my persistence.xml and then using a spring object to
dictate which one to load based on passing in a flag into my constructor in
my tests.  This has worked fine, other than the problem I've mentioned
below.  When I separated them into two different files, I started getting a
lot of complaining from hibernate.  I think because I must have parts in my
tests that aren't using the mocked out object and therefore causing
hibernate to try to load the one that is nonexistent...  All our other
projects use the database directly instead of mocking out the database
connection because I haven't found an acceptable way to do it.. just easier
to let everything modify the test database.

I find your second solution interesting.. and I think maybe a bit cleaner
... it's actually what I was hoping someone would point me to.  My confusion
is still the same though, how would maven know to load the file and
substitute the property?  And if it's hibernate that would do it, then how
would it get it at runtime?  Would I always have to pass in a system
property?  I guess I should look up properties and the persistence.xml ...
maybe there is something I'm just not understanding.

Ryan


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to