You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Stephane Eybert <mi...@yahoo.se> on 2010/05/09 20:03:35 UTC
Maven filter and hsqldb mem hibernate.hbm2ddl.auto
Hello,
I have a pom.xml file with a filter for some data source properties.
The filter works for the data source properties, that is, for:
hibernate.dialect=org.hibernate.dialect.HSQLDialect
dataSource.driverClassName=org.hsqldb.jdbcDriver
dataSource.url=jdbc:hsqldb:mem:testdb
dataSource.username=sa
dataSource.password=
and my integration test is successful.
But when having also the following property in the filter file
hibernate.hbm2ddl.auto=create
I get an error message saying the sql statement could not be performed
because the table does not exist.
What happens is that HSQLDB (in memory) does not create my table before
running the test, if the hibernate.hbm2ddl.auto is in the filter file
instead of being hard coded in the spring hibernate factory bean.
But the property hibernate.dialect does not pose such a problem. It is
happily replaced by the value in the filter file.
I would like to have the property hibernate.hbm2ddl.auto being replaced by
the value in the filter file, so as to have a different value, when running
the integration test in HSQLDB (value should be create) and when running in
production (value should be validate).
http://old.nabble.com/file/p28504415/spring-hibernate.xml
spring-hibernate.xml
http://old.nabble.com/file/p28504415/data-source.properties
data-source.properties http://old.nabble.com/file/p28504415/pom.xml pom.xml
--
View this message in context: http://old.nabble.com/Maven-filter-and-hsqldb-mem-hibernate.hbm2ddl.auto-tp28504415p28504415.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven filter and hsqldb mem hibernate.hbm2ddl.auto
Posted by Stephane Eybert <mi...@yahoo.se>.
I just realized that I had attached the module pom.xml file instead of the
parent one, so you could not really see the setup I have.. Here is the
parent pom.xml file: http://old.nabble.com/file/p28512487/pom.xml pom.xml
--
View this message in context: http://old.nabble.com/Maven-filter-and-hsqldb-mem-hibernate.hbm2ddl.auto-tp28504415p28512487.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven filter and hsqldb mem hibernate.hbm2ddl.auto
Posted by Jemos Infra <je...@googlemail.com>.
This is a snippet from your message:
[quote]
Thanks for your reply. But I wonder how come the file in the target
directory shows all the properties being filtered fine.
A look at the file core/target/classes/spring-hibernate.xml shows the
property place holders replaced by the corresponding values.
But a look at the file core/target/test-classes/spring-hibernate.xml
shows
that the property place holders were NOT replaced.
[/quote]
>>From what you wrote it seemed that you did not specify filtering for
your test resources (hence only the src/main/resources were filtered and
I suggested to you do declared the <testResources> element in your POM
also giving you a link to a page which shows the syntax.
Regards,
M.
On Sun, 2010-05-09 at 14:15 -0700, Stephane Eybert wrote:
> Hum... I wonder what you meant here..
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven filter and hsqldb mem hibernate.hbm2ddl.auto
Posted by Stephane Eybert <mi...@yahoo.se>.
Hum... I wonder what you meant here..
--
View this message in context: http://old.nabble.com/Maven-filter-and-hsqldb-mem-hibernate.hbm2ddl.auto-tp28504415p28505451.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven filter and hsqldb mem hibernate.hbm2ddl.auto
Posted by Jemos Infra <je...@googlemail.com>.
I believe the following snippet (from
http://maven.apache.org/pom.html#Resources) could solve your situation:
<resources>
<resource>
<targetPath>META-INF/plexus</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/plexus</directory>
<includes>
<include>configuration.xml</include>
</includes>
<excludes>
<exclude>**/*.properties</exclude>
</excludes>
</resource>
</resources>
<testResources>
...
</testResources>
>>From what you are saying it appears that filtering has not been applied to test resources.
M.
On Sun, 2010-05-09 at 13:05 -0700, Stephane Eybert wrote:
> Hi Jemos,
>
> Thanks for your reply. But I wonder how come the file in the target
> directory shows all the properties being filtered fine.
>
> A look at the file core/target/classes/spring-hibernate.xml shows the
> property place holders replaced by the corresponding values.
>
> But a look at the file core/target/test-classes/spring-hibernate.xml shows
> that the property place holders were NOT replaced.
>
> So, the filtering works in a way that escapes me... It seems to filter
> something, creating a filtered file at
> core/target/classes/spring-hibernate.xml but not doing it for the file
> core/target/test-classes/spring-hibernate.xml
>
> What puzzles me is that I only run an integration test with the command:
>
> mvn clean test -Pitest
>
> Here are the generated files in the target directory, one in classes/
> filtered fine and the other one in test-classes not filtered:
>
> http://old.nabble.com/file/p28505207/spring-hibernate.xml
> spring-hibernate.xml
>
> http://old.nabble.com/file/p28505207/spring-hibernate.xml
> spring-hibernate.xml
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Maven filter and hsqldb mem hibernate.hbm2ddl.auto
Posted by Johann Reyes <jr...@vaporwarecorp.com>.
Hello Stephane
Do you want to do something like this??
https://svn.codehaus.org/mojo/trunk/sandbox/hibernate3-maven-plugin/src/it/m
hibernate-65
Johann Reyes
-----Original Message-----
From: Stephane Eybert [mailto:mittiprovence@yahoo.se]
Sent: Sunday, May 09, 2010 4:06 PM
To: users@maven.apache.org
Subject: Re: Maven filter and hsqldb mem hibernate.hbm2ddl.auto
Hi Jemos,
Thanks for your reply. But I wonder how come the file in the target
directory shows all the properties being filtered fine.
A look at the file core/target/classes/spring-hibernate.xml shows the
property place holders replaced by the corresponding values.
But a look at the file core/target/test-classes/spring-hibernate.xml shows
that the property place holders were NOT replaced.
So, the filtering works in a way that escapes me... It seems to filter
something, creating a filtered file at
core/target/classes/spring-hibernate.xml but not doing it for the file
core/target/test-classes/spring-hibernate.xml
What puzzles me is that I only run an integration test with the command:
mvn clean test -Pitest
Here are the generated files in the target directory, one in classes/
filtered fine and the other one in test-classes not filtered:
http://old.nabble.com/file/p28505207/spring-hibernate.xml
spring-hibernate.xml
http://old.nabble.com/file/p28505207/spring-hibernate.xml
spring-hibernate.xml
--
View this message in context:
http://old.nabble.com/Maven-filter-and-hsqldb-mem-hibernate.hbm2ddl.auto-tp2
8504415p28505207.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven filter and hsqldb mem hibernate.hbm2ddl.auto
Posted by Stephane Eybert <mi...@yahoo.se>.
Hi Jemos,
Thanks for your reply. But I wonder how come the file in the target
directory shows all the properties being filtered fine.
A look at the file core/target/classes/spring-hibernate.xml shows the
property place holders replaced by the corresponding values.
But a look at the file core/target/test-classes/spring-hibernate.xml shows
that the property place holders were NOT replaced.
So, the filtering works in a way that escapes me... It seems to filter
something, creating a filtered file at
core/target/classes/spring-hibernate.xml but not doing it for the file
core/target/test-classes/spring-hibernate.xml
What puzzles me is that I only run an integration test with the command:
mvn clean test -Pitest
Here are the generated files in the target directory, one in classes/
filtered fine and the other one in test-classes not filtered:
http://old.nabble.com/file/p28505207/spring-hibernate.xml
spring-hibernate.xml
http://old.nabble.com/file/p28505207/spring-hibernate.xml
spring-hibernate.xml
--
View this message in context: http://old.nabble.com/Maven-filter-and-hsqldb-mem-hibernate.hbm2ddl.auto-tp28504415p28505207.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven filter and hsqldb mem hibernate.hbm2ddl.auto
Posted by Jemos Infra <je...@googlemail.com>.
Stephane, the pom doesn't show any filtering / hibernate plugin.
Regards,
M.
On Sun, 2010-05-09 at 11:03 -0700, Stephane Eybert wrote:
> Hello,
>
> I have a pom.xml file with a filter for some data source properties.
>
> The filter works for the data source properties, that is, for:
>
> hibernate.dialect=org.hibernate.dialect.HSQLDialect
> dataSource.driverClassName=org.hsqldb.jdbcDriver
> dataSource.url=jdbc:hsqldb:mem:testdb
> dataSource.username=sa
> dataSource.password=
>
> and my integration test is successful.
>
> But when having also the following property in the filter file
>
> hibernate.hbm2ddl.auto=create
>
> I get an error message saying the sql statement could not be performed
> because the table does not exist.
>
> What happens is that HSQLDB (in memory) does not create my table before
> running the test, if the hibernate.hbm2ddl.auto is in the filter file
> instead of being hard coded in the spring hibernate factory bean.
>
> But the property hibernate.dialect does not pose such a problem. It is
> happily replaced by the value in the filter file.
>
> I would like to have the property hibernate.hbm2ddl.auto being replaced by
> the value in the filter file, so as to have a different value, when running
> the integration test in HSQLDB (value should be create) and when running in
> production (value should be validate).
>
> http://old.nabble.com/file/p28504415/spring-hibernate.xml
> spring-hibernate.xml
> http://old.nabble.com/file/p28504415/data-source.properties
> data-source.properties http://old.nabble.com/file/p28504415/pom.xml pom.xml
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org