fix compilation errors and add jpa annotations