Very nice Spring-Intro! Worth to become part of the official documentation.
"To start off with my new (Enterprise) Java Development Blog here on StSMedia.net I would like to gradually develop a sample application which demonstrates various aspects of the Spring framework and some of its related projects and products."
Spring Remoting with Security and SSL
September 30th, 2008 by Mattias Hellborg Arthursson — Security, Spring
Avatar of Mattias Hellborg Arthursson
One of my favorite features of the Spring Framework is the Spring Remoting part, which enables you to expose any bean in a Spring Application Context as a remote service over HTTP. It's fast, it's easy, and it's really, really simple.
Hibernate saveOrUpdate trap for web developers and StaleStateException
Summary: Hibernate users should be aware of saveOrUpdate method if they continue to use the same persistent object even if a transaction failed at some point.
Details:
Suppose you have a persistent object bound to your web(like JSF) views. Entered some data (which will lead to a db ConstraintViolationException) and tried to save it (at your DAO service) by using saveOrUpdate method. As we expected, it will throw a ConstraintViolationException and you'll rollback the transaction.
Then, go back to the entry page, correct the wrong field value at the same object, and try to save it again. You'll get a StaleStateException since saveOrUpdate method assigned identifier values automatically to your new object when you attempt to save it first. Later, when the save operation failed, it didn't roll back your object's state to its initial state. The summary of the flow causing this error is as below;
Hibernate Annotations is my preferred way to map my entity classes, since they don't require any external file (thus keeping mapping info in your Java files), is fully integrated with all Hibernate mapping capabilities and Hibernate documentation encourages us to use this kind of configuration because it's more efficient.
Annotation driven mapping in Hibernate uses the standard JPA API annotations and introduce some specific extensions to deal with some Hibernate features. You can find a full reference in the official documentation.
Exception Handling with Spring and Log4J
How to log exceptions. This technique will log messages to your server log file, send an email, with the tag stack of the error, for error level warnings and display a generic page to the user.
First step is to set up Log4j.
Make sure you have the following classes in application lib or common server lib.
activation.jar
This can be got from http://java.sun.com/products/javabeans/jaf/downloads/index.html
Set up your log4J configuration file, put this file in your WEB-INF directory
Workflow Reloaded : Moving to OSWorkflow
I have been trying to model a workflow for one of my applications. I started with Bossa, but after getting stuck using parts of its API, I was well on my way to designing my own workflow engine using Bossa's Petri Net abstraction, until a colleague pointed out that I was trying to re-invent something for which solid, mature implementations already existed in the open-source world, and that, down the road, other developers would curse me for having stuck them with having to maintain this component.
The traditional way to integrate JSF and Spring was to define JSF beans in faces-config as managed beans and refer to the spring beans using the managed-property configuration. With the help of the spring’s delegatingvariableresolver the managed property is resolved from spring application context and JSF’s IOC injects the bean to the JSF Managed bean instance. I’ve written an article it about this way before.First approach is modelled as follows