CacheModes in Hibernate
Hibernate offers us a CacheMode option. This is something that allows us to control the behavior of the second level cache. Consider the below code:publicstatic void testGetMode() { Statistics...
View ArticleCacheModes in Hibernate - continued
In the previous post we saw the GET and IGNORE values for CacheMode. The other values are PUT and REFRESH. Consider the below code:publicstatic void testPutMode() { Statistics statistics =...
View ArticleException Handling in Spring REST calls
I earlier did a post on error handling in Spring web applications. It was related to generating views for errors. But in a REST application we would prefer to return error codes or error JSON message....
View ArticleInjecting Dependencies in a CXF Endpoint
We have seen how easy it is to create CXF endpoints. In the previous post on WSDL first web services we had defined server endpoints as: <jaxws:endpoint id="randomWs"...
View ArticleDifferent Message Formats in Spring MVC
In an earlier post we saw how Spring depended on MessageConverters to convert the request stream to java object and also the java objects to appropriate response formats.As we had defined a Jackson...
View ArticleHibernate's custom annotations
In the previous few posts we saw how JPA provides us with an annotation driven approach to configure our entities. As with all standard APIs, when vendors implemented JPA, they found that the...
View ArticleBeanFactory and Inheritance
Inheritance of Beans is a feature available in Spring Bean Factories. I decided to try the same using Spring's BeanFactory.The first step was to create a parent BeanFactory: final...
View ArticleThe c namespace
With the growth of annotations XML configuration files continue to reduce in size (In some cases they have disappeared). I have never really been a fan of Annotations, especially those that bring in...
View ArticleMethod Injection in Spring
I knew Spring supports two types of injection - setter and constructor. I had also heard of a third type called method injection. But having never come across a use case for the same, I pretty much...
View ArticleHeaders in SOAP
What is a soap header ?From w3schools: The optional SOAP Header element contains application-specific information (like authentication, payment, etc) about the SOAP message. If the Header element is...
View ArticleSOAP Header at Client
In the previous post we saw CXF endpoints could set a soap header in the response. But what if the server needs to process a soap header ? The CXF website recommends using interceptors for reading...
View ArticleSOAP Action Header
How does a simple WSDL file look?There will be a portType element that is like an interface definition of the web-service. It would tell us :What type of input is expected and what output would be...
View ArticleSaving an Enum in JPA
Consider the below entity: @Entity@Table(name = "STUDENT")publicclass Student { @Id @GeneratedValue(strategy = GenerationType.IDENTITY)privateLong id; @Column(name = "NAME")privateString name;private...
View ArticleSpring Security - The Login Flow
In the last post we saw how Spring security can be used to secure web applications. I used both the form login and the basic login to get the user authentication done.While basic login is pretty much...
View Articleform-login Custom Options
In the previous post we saw how to set the login page as a custom one. There are other configuration options available too. For instance: <form-login...
View ArticleLogout Settings in Spring Security
We have seen how to configure login behavior for our application. How to let Spring manage authentication, session creation, authorization etc.The logical end to the flow would be to logout. A normal...
View ArticleInterrupting a Thread
I was asked to do a revision in threads a while back - so as to then start understanding the concurrency package. I decided to do it from the Sun's Concurrency tutorial. I liked the part of sleeping...
View ArticleUnderstanding volatile
Before I start - I have never used volatile nor can I claim to well versed at it. To be more accurate my understanding of the java volatile keyword is zilch. Part of the reason is that I never used it....
View ArticleAnybody just give me the result !!
I came across the invokeAny method of ExecutorService and liked the idea a lot. There could always be the case that you have a set of input of which you care to see any one processed. Once we have an...
View ArticleAnd They All Work Together
In the previous post we had a look at the invokeAny method that allowed us to get the result from the first thread to complete. ExecutorService also provides us with the invokeAll method that will...
View Article