1-N and N-1 relationship with hibernate