Search This Blog

Sunday, 11 August 2013

Spring Security

All projects I have worked on included login. And roles. They were built using database tables or third party applications like LDAP or service based authentication. However the new projects starting now are going ahead with Spring Security. As I have no idea about it, I decided to give a go at understanding Spring Security.
I decided to first do a small simple web application and enable the security for it. Not spring based, simple Servlet style security.

Friday, 9 August 2013

Custom Marshaling With JAXB

Consider the below class:
@XmlRootElement
public class Person {
   private String name;
   private BigDecimal weight;
   private Date dob;

   // getters and setter
}
If we were to marshal a Person instance the generated XML would be:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<person>
   <dob>2013-06-15T13:01:35.420+05:30</dob>
   <name>Test</name>
   <weight>65.876499999999992951416061259806156158447265625</weight>
</person>
The value for dob is a little complex. Could we change this to a more suitable value ?

Tuesday, 6 August 2013

DataBinding Options with CXF

When using CXF, the marshaling and unmarshaling of data happens under the covers. So when we make the call through java, the request is marshaled to XML by CXF client. It sends it over the wire to the server.

Monday, 5 August 2013

Excluding a property from the ORM framework

If we have a property that does not map to any column in the table, we simply do not specify that property in our hbm files. But with JPA annotations it is a little different. A class if marked with an Entity annotation, all its properties are considered persistent by default. So how do we exclude a property ?

Thursday, 1 August 2013

Can we mark entity classes as final ?

We have already seen that Hibernate extensively uses proxies. It uses proxies when we call load, it uses proxies for lazily loading associations and collections.But what if our entity class was final ?