small changes , tried to do the mapping for hibernate ( it is not tested yet )