Showing posts from November, 2013

Bean Validation : Hibernate Validator framework

Bean Validation with Hibernate Validator framework JSR 303 This JSR will define a meta-data model and API for JavaBean TM validation based on annotations, with overrides and extended meta-data through the use of XML validation descriptors. JSR 349 Bean Validation standardizes constraint definition, declaration and validation for the Java platform. For more information on Bean Validation and how to participate, check out .  Hibernate Validator Hibernate Validator 5.x is the reference implementation for JSR 349 - Bean Validation 1.1 of which Red Hat is the specification lead. Sample Implementation. In the sample implementation, we have a class with validation annotations. A test class to validate the object and to print the error messages at the console. The code is completely self explanatory.

Hibernate Annotations - OnetoOne Mapping

Hibernate Annotations JPA 1   One to One Mapping   Class package com.domain; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToOne; import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.Table; @Entity @Table(name = "employeeaddress") public class EmployeeAddress implements {     private static final long serialVersionUID = 1L;     // Fields     private Integer employeeid;     private String address;     private Employee employee;     // Constructors     /** default constructor */     public EmployeeAddress() {     }     /** minimal constructor */     public EmployeeAddress(Integer employeeid) {         this.employeeid = employeeid;     }     /** full constructor */     public EmployeeAddress(Integer employeeid, String address) {         this.employeeid = employeeid;         this.address = address;