Posts

Showing posts with the label xml

Hibernate CRUD operations with example

Read this article to know what is CRUD and how to do CRUD operations in hibernate with example. CRUD stands for Create, Read, Update and Delete. As part of hibernate learning CRUD operations are the most basic operations. In previous examples, I have explained by using the MySQL configuration in Hibernate. But, in the current example, I am explaining by using Oracle as well as MySQL configuration. The choice is yours, use at your convenience. As of you people already know if we have to change the Database vendors no need to rewrite the entire code, it’s just a configuration file change. So, except the hibernate.cfg.xml file remaining all files logic will be common for both of the databases like Oracle or MySQL. Before going to write the hibernate logic, we have small work with the databases either Oracle or MySQL. Execute the below query to create the table in the database. Before going to execute the below query make sure you have connected with the specific Schema in the dat

How to create spring application by using eclipse IDE

Image
To create spring application by using eclipse IDE, we have to follow below steps. There are majorly 5 steps we mentioned for how to create spring application by using eclipse IDE. That are, Create Java Project Add spring jar files Create the bean class Create XML file to provide values Create the Test class Create Java Project:         Follow these suggestions to create a new Java Project in Eclipse IDE. File --> New --> Java Project         Click 'Next' and then click 'Finish'. Add Spring libraries:         Once creating the project you can download the Spring core module libraries from the Internet and add it into your creating project. Spring core library files:         The below which I mentioned library files are related to Spring core module. In that which are mandatory and which are optional library files also I defined in below. Download those all library files from Internet and add into newly creating Spring

Hibernate auto increment with example

In previous example we learn how to map java object with database table for manually(not using auto increment) assigned all the values.  To create primary key auto increment application by using hibernate mapping(hbm.xml) or using annotations continue reading this article.  W e need to create a database and create an employee table by using the below query. Table: CREATE table EMPLOYEE( eid integer ( 10 ) primary key not null , firstname varchar ( 30 ), lastname varchar ( 30 ), designation varchar ( 30 ), salary double( 10 , 2 )); Here, we will create a bean/POJO (Plain Old Java Object) class of employee. Employee.java: package com . javatbrains . hibernate ; import java.io.Serializable ; /*This is the POJO class. It contains only Getter and Setter methods*/ public class Employee implements Serializable { private static final long serialVersionUID = - 75885815725314443L ; private int eid ; private String firstName ;