Spring3
Added by Kevin Dewi 7 months ago
Hello,
I use spring 3 in my project. How can I activate the spring3 profile in the maven dependency configuration?
greetings
kevin
Replies
RE: Spring3
-
Added by Oliver Gierke 7 months ago
The spring3 profile is just included in the pom.xml to allow building Hades against Spring 3 to ensure compatibility. To simply run Hades on top of Spring 3 just switch to the Spring 3.0 JARs and Hades will happily run with 'em. Note, that the pom states the OSGi ready bundles from the Enterprise Bundle Repository (artifactIds: org.springframework.jdbc e.g.). If you need to use the non-OSGi ready ones (arfiactIds: spring-jdbc e.g.) you have to manually exclude the OSGi based ones.
RE: Spring3
-
Added by Anthony Goubard 6 months ago
Hi,
Here is a part of my pom.xml for Hades.
Note that Hades is still not working for my project but I guess it's no more a question of classpath.
Important: Check your WEB-INF/lib for old libraries that were copied and not removed when you changed your pom.xml.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.0-Beta-3</version>
</dependency>
<dependency>
<groupId>org.synyx.hades</groupId>
<artifactId>org.synyx.hades</artifactId>
<version>1.1</version>
<!-- Use Spring 3.0 -->
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.orm</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context</artifactId>
</exclusion>
<exclusion>
<artifactId>com.springsource.javax.persistence</artifactId>
<groupId>javax.persistence</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
Hope that helps.
Anthony
RE: Spring3
-
Added by Oliver Gierke 6 months ago
Hey Anthony,
cool to see theres community support for Hades already. Just some minor notes on that:
- Don't need to exclude the Spring dependencies as long as you can live with the OSGi ready artifact id's. Just restate them in version 3.0.0.RELEASE
- Hades is currently built and testet to work against Hibernate 3.3.2.GA as 3.4 and 3.5 do not work with latest Spring 2.5.x. This in turn means that Hades in 1.x branch probably does not support JPA 2.0 yet (to be honest, I haven't tried yet). Depending on the efforts to introduce compatibility with JPA 2.0 we'll see it in a 1.5 or even 2.0, whereas 2.0 does not mean "in 6 month".
Regards,
Ollie
RE: Spring3
-
Added by Anthony Goubard 6 months ago
Thanks for your feedback.
the error I had was .save(myObject) was not calling the database as List<MyObject> readAll() returned and empty list when called after the save method.
Regards,
Anthony
RE: Spring3
-
Added by Oliver Gierke 6 months ago
Don't know if this is a bug at all. Be aware that the syncing with the database only occurs when the underlying session is flushed. So in a test case I'd always rather use saveAndFlush(object) to ensure flushing.
RE: Spring3
-
Added by Anthony Goubard 6 months ago
Yes but flush threw an Exception that no transaction was started and trying to use JTA instead of RESOURCE_LOCAL in persistence.xml threw other exceptions.
RE: Spring3
-
Added by Oliver Gierke 6 months ago
This is correct as you have to use Spring transaction infrastructure (see reference documentation chapter 2.2 and Spring transaction documentation).