Custom Validation

Activity: Custom validation Perform custom validation based on your business rulesOur example: Course Code must start with "KVT"Spring MVC calls our custom validationCustom validation returns Boolean value for pass/fail (true/false) Development Process Create custom validation rule Add validation rule to Customer classDisplay error message on HTML formUpdate confirmation page Breaking from up top //  "CourseCodeConstrainValidator.class" … Continue reading Custom Validation

entity-lifecycle-model

Entity Lifecycle Model in JPA & Hibernate The entity lifecycle model is one of the core concepts of JPA and all its implementations. Even though it’s not directly visible when working with JPA’s EntityManager, it affects all operations you perform. The different states of the model define how your persistence provider, e.g. Hibernate, handles your … Continue reading entity-lifecycle-model

Advance Hibernate Mapping Overview

Basic Mapping: Advance Mappings In the database you most likely will haveMultiple tablesRelationships between TablesNeed to model this with Hibernate Advanced Mappings Type One-to-OneOne-to-Many, Many-to-OneMany-to-Many Important Database Concepts Primary key and foreign keyCascade Primary Key and Foreign Key Primary Key: identify a unique row in a tableForeign Key:Link tables togetherA field in one table that … Continue reading Advance Hibernate Mapping Overview

FAQ: How To View Hibernate SQL Parameter Values

Question: I see hibernate printing out the query parameters as ? in the console.Is it possible to printout the value that was actually queried on thedatabase. Asking as this would help in the debugging purpose. Answer: When using Hibernate, if you log the Hibernate SQL statements, you will see this: Hibernate: insert into student (email, first_name, last_name, … Continue reading FAQ: How To View Hibernate SQL Parameter Values

Hibernate Development Process :CRUD

To Do List Add Hibernate Configuration fileAnnotate Java ClassDevelop Java Code to perform database operations Hibernate uses JDBC in the background for communicating with the database So the bulk of the information we will have in our config file is actually JDBC configuration (url, userid, password and so on … ), just to tell hibernate … Continue reading Hibernate Development Process :CRUD

Setting up Hibernate Development Environment

Setup your development Required Softwares To Build Hibernate Applications, you need the following: Java Integrated Development Environment (IDE)Database Server (MySQL server)Hibernate JAR files and JDBC Driver Create a new Java project Create a new folder "lib" for Hibernate jar files Download Hibernate ORM zip form hibernate.org Now download JDBC drivers (Connector/J) zip from link below: … Continue reading Setting up Hibernate Development Environment