Hibernate Basics »



Introduction Hibernate is a solution for object relational mapping and a persistence management solution or persistent layer. This is probably not understandable for anybody learning Hibernate. What you can imagine is probably that you have your application with some functions (business logic) and you want to save data in a database. When you use Java [...]

Connecting our Class(say x) to DataBase using Hibernate »



In this file the mapping from our class Honey to the database table honey is configured. Create a Test Client Create a Java Class ?TestClient? in the package ?de.laliluna.example?. Add the following source code. It includes methods to create entries in the database, to update and to list them. /** * Test application for example [...]

Mapping Files in Hibernate »



Create the mapping files Create a new file named ?hibernate.cfg.xml? in your root directory if it is not already created. Insert the following in your hibernate file. Do not forget to change the username and the password to suit your database configuration. PostgreSQL Version: jdbc:postgresql://localhost/firsthibernate postgres org.postgresql.Driver org.hibernate.dialect.PostgreSQLDialect p org.hibernate.transaction.JDBCTransactionFactory thread true

Example of Hibernate »



Create the class Create a new class named ?Honey? in the package ?de.laliluna.example?. Add three fields id, name and taste and generate (Context menu -> Source -> Generate Getter and Setter) or type the getters and setters for the fields. Then create an empty constructor. package de.laliluna.example; /** * @author ………….. * */ public class [...]