Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreWelcome to another installment of This Week in Spring! This roundup is put together by aggregating lots of great content from all around the web. If you have content suggestions, or if you simply want a direct line to some of the content that we post, check us out on Twitter, and Google+. As usual, we've got a lot to go over, so let's dive into it.
The video from Spring Data Neo4J lead Michael Hunger's excellent webinar <a href = "http://www.springsource.org/node/3632">introducing Spring Data Neo4j</a> is also available.
The video from VMWare engineer Jerry Kuch's webinar providing an update on the new features in RabbitMQ is also available. Finally, the video from the webinar that Ken Rimple, Srini Penchikala, and I did introducing how to more fully exploit Spring Roo's interactive add-on mechanism is available.
<LI> Remember our pal Tobias Trelle? He's got another fantastic article that's been published on InfoQ called <a href = "http://www.infoq.com/articles/spring-data-intro"><EM>Spring Data - One API to Rule Them All?</EM></a></LI>
Note that this sort of code is ideal for delivery as a AOP Aspect.
</LI>
HibernateTemplate
to work
with Hibernate's lazy initialization feature. It's a nice post, but it's worth mentioning that the HibernateTemplate
's no longer the preferred way of working with Hibernate. Instead, simply create a HibernateTransactionManager
instance, and build a SessionFactory
using the LocalSessionFactoryBean
(available for both Hibernate 3 and Hibernate 4) and then you're done. For a good example,
check out this sample application
which demonstrates Hibernate 4. You can use the Hibernate thread-local session API (which has been available since later iterations of Hibernate 3.x). To specifically handle lazy initialization, look at Hibernate.initialize(Object)
.
JmsTemplate
makes it quite simple to send
and receive
messages using JMS. If you want to asynchronously receive messages, then you should consider the MessageListenerContainer
implementations. If you're going to use JmsTemplate
to receive messages outside of a Java EE application server (which typically provide connection factory pooling), consider using the CachingConnectionFactory
implementations to wrap the raw JMS connection factories. By default the JmsTemplate
handles all the tedious resource acquisition and destruction logic involved in working with the JMS API. This includes shutting down connection factories and sessions, which can be expensive if the resources are actually closed, and not simply returned to a pool where they're subsequently reused.
You know what I love the most about this post, though? Not only does the post articulate the correct strategies for working with Spring, but the blogger even went to the Apache Wiki's and corrected them where appropriate! Nice job, great post, and even greater initiative!