Posts

Showing posts with the label hibernate

Hibernate configuration and startup

The regular way of initializing Hibernate is to build a SessionFactory object from  a Configuration object. If you like, you can think of the Configuration as an  object representation of a configuration file (or a properties file) for Hibernate. Let’s look at some variations before we wrap it up in the HibernateUtil class. Building a SessionFactory This is an example of a typical Hibernate startup procedure, in one line of code,  using automatic configuration file detection: SessionFactory sessionFactory =  new Configuration().configure().buildSessionFactory(); Wait—how did Hibernate know where the configuration file was located and  which one to load? When new Configuration() is called, Hibernate searches for a file named  hibernate.properties in the root of the classpath. If it’s found, all hibernate.*  properties are loaded and added to the Configuration object. When configure() is called, Hibernate searches for a file named hibernate. c...

Installing and using Hibernate tools in Eclipse Indigo

Image
In this post ill be showing installation of Hibernate tools in eclipse Indigo followed by use of Hibernate tools to do a simple hibernate One to Many example. Step 1: Click on the help on the toolbar at the bottom of the drop down we will see eclipse marketplace. Click on the eclipse marketplace which opens a new window. Step2: In the find option type the key words   Hibernate tools for Indigo .  Fig: Showing the eclipse market place Step 3: Click on install button to install the Hibernate tools plugin to eclipse Indigo. One To Many Example using Hibernate tools Step 1: A java project name a 01usinghibernatetools right click on the project; At the bottom of the drop down select the properties option.      Step 2: Click on the hibernate settings option as shown above and click on the enable hibernate support check box. Click on apply followed by clicking Ok. Step 3: Click on the  window  option on eclipse tool bar followe...

SOAP (JAX-WS) Web Service Tutorial with Apache CXF, eclipse and maven

Image
In the previous tutorial  RESTful service with Apache CXF  was demonstrated. This tutorial modifies the same one for SOAP based Web Service. Step 1 : You need to bring in the relevant CXF framework JAR files. The transitive dependencies will bring in the other dependent Spring jar files, JAXB jar files, and many other jar files listed in the screenshot below. The pom.xml file is shown below: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 <project xmlns= " http://maven.apache.org/POM/4.0.0 " xmlns:xsi= " http://www.w3.org/2001/XMLSchema-instance "   xsi:schemaLocation= " http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd " >   <modelVersion>4.0.0</modelVersion>   <groupId>com.mytutorial</groupId>   <artifactId...