We have used Spring Roo in a web project and show how we generated an early prototype and transistioned to early development and then to production code.
The point of "Graham Hacking Scala" is to share with you my knowledge of and experience with the Scala programming language. The blog will contain everything from introductions to basic features through to in-depth analysis of complex techniques and problems. When I make mistakes, you will learn from my mistakes. When I discover cool features, you will learn about them, too.
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.
With the addition of generics in Java 5, writing a custom DAO for each domain object is no longer required. There are a wide variety of articles on creating generic DAOs, but my current project uses the approach from this IBM DeveloperWorks article. This approach was choses mainly because of the clearly written article and the integration with Spring. You should be able to extend any generic DAO based on Spring to implement the stored procedure configuration.
Thought I've bookmarked this a long time ago... "With the adoption of Java™ 5 generics, the idea of a generic typesafe Data Access Object (DAO) implementation has become feasible. In this article, system architect Per Mellqvist presents a generic DAO implementation class based on Hibernate. He then shows you how to use Spring AOP introductions to add a typesafe interface to the class for query execution."
Business process management (BPM) – while also its own independent practice / school of thought – is an application of technology that is served by many products, not the least of which is jBPM. The best definition of BPM that I've found is: "Business Process Management (BPM) is the concept of shepherding work items through a multi-step process. The items are identified and tracked as they move through each step, with either specified people or applications processing the information. The process flow is determined by process logic and the applications (or processes) play virtually no role in determining where the messages are sent.".
The mock-object testing pattern has commonly been used to test an individual unit of code without testing its dependencies. While this pattern works well for interaction-based testing, it can be overkill for state-based testing. Learn how to streamline your unit-testing using stubs and the pseudo-objects testing pattern.
The Spring Framework's applicability in the context of Swing seems to be underhighlighted, at least when one looks around on the web. What does Spring have to offer in this context? Rather than a highly theoretical discussion, let's look at a complete, compilable example, step by step, and draw our conclusions from there.