Tag Archives: Kepler

Hibernate JBoss Tools Installation in Eclipse + Mapping Generation Example


via Hibernate JBoss Tools Installation in Eclipse + Mapping Generation Example | Examples Java Code Geeks.

Generating .hbm.cfg files or creating annotated files to map your classes is always a bit boring and it involves writing a lot of boilerplate code. In Eclipse you can use JBoss Hibernatate Tools, with which you can automatically generate all the files you need to work with Hibernate. In this tutorial we are going to see how to install Hibernate Tools in Eclipse and explore how you can generate mapping files automatically.

So these are the tools we are going to use on a Windows 7 platform:

  • JDK 1.7
  • Maven 3.0.5
  • Hibernate 4.2.3.Final
  • MySQL JDBC driver 5.1.9
  • Eclipse 4.3 Kepler

And this is the project I am going to use as the basis for the example : HibernateMySQLExample.zip. Download it and open it with Eclipse IDE.

Hibernate Data Filter Example (XML And Annotation)


via Hibernate Data Filter Example (XML And Annotation) | Examples Java Code Geeks.

In this tutorial we are going to see how can you declare and use Hibernate Data Filters. Filters are a very useful feature in Hibernate, that enables to filter your  received data from the database according to a custom condition. Filters have a unique name for identification and can accept parameters and can also be used with XML mapping and Annotation mapping, as we are going to demonstrate.

So these are the tools we are going to use on a Windows 7 platform:

  • JDK 1.7
  • Maven 3.0.5
  • Hibernate 4.2.3.Final
  • MySQL JDBC driver 5.1.9
  • Eclipse 4.3 Kepler

The basis of this tutorials is going to be this Eclipse project: HibernateMySQLExample.zip. And it’s based in Hibernate 3 with Maven 2 and MySQL 5 Example (XML Mapping and Annotation).

Create Web Application Project with Maven


In this tutorial, we will show you an easy way to create a Java web application project, using Apache Maven. The web application will make use of the Spring MVC and it will be transformed, in order to be recognizable and supported by the Eclipse IDE. Original Post>>

In this example, we use the following tools on a Windows 7 platform:

  • Apache Maven 3.1.1
  • Eclipse Kepler Service Release 1
  • JDK 1.7
  • Spring 3.2.3.RELEASE
  • Apache Tomcat 7

Hibernate Interceptor


Hibernate Interceptor

In this example we are going to see how to use Hibernate Interceptor. During a Hinernate transaction, an object might go through a number of phases: it is created, it gets updated, it gets persisted or deleted. An Interceptor detects the most basic events in the database, like CRUD operations. On each events it fires up callback methods. There are numerus usages of this feature, and as you can imagine one of the most basic is logging.

You can use an Interceptor to log a list of events that happend during. The thing is that you can use any logging methods or frameworks you want, so that makes your program easily extendible. Or you can even log your events in a database table without using any logging framworks or the client machine’s file system, which make it more portable.

o these are the tools we are going to use on a Windows 7 platform:

  • JDK 1.7
  • Maven 3.0.5
  • Hibernate 4.2.3.Final
  • MySQL JDBC driver 5.1.9
  • Eclipse 4.3 Kepler

The basis of this tutorials is going to be this Eclipse project: HibernateMySQLExample.zip. And it’s based in Hibernate 3 with Maven 2 and MySQL 5 Example (XML Mapping and Annotation).

Hibernate Named Query


Hibernate Named Query

When working with Hibernate and Hibernate HQL, you will find yourself writing again and again the same tedious queries. Not only that, but most of the times these queries are scatterd throuout your code making it very hard too read and even harder to maintain. Hibernate Named Queries can provide a way of solving this problem. With Named queries you can define your customized queries written in SQL or HQL and then give them a name.

You can use that specific name any time you want to create and execute that query. Of course you have still the option of binding parameters etc. In some ways Named Queries are like stored procedures or like the public methods of a class. You can use a public method of a class to manipulate, read and write date to your class instance.

There are to basic ways you can declare named queries. One is using the .hbm.xml mapping file of you’re mapped class or by annotations.

So these are the tools we are going to use on a Windows 7 platform:

  • JDK 1.7
  • Maven 3.0.5
  • Hibernate 4.2.3.Final
  • MySQL JDBC driver 5.1.9
  • Eclipse 4.3 Kepler

Hibernate Connection Pool configuration with C3P0


Hibernate Connection Pool configuration with C3P0

This is a tutorial on how to use C3P0 connection pool framwork with Hibernate. Basically what a connection pool does is to create a number of connections (a pool of connections) with the database server and keep them idle. Every time a query comes up the application picks one of the pooled connections and uses that to interact with the database. Connection pools substantialy help performance because your application doesn’t have to create a new connection to the database server every time a query is submited.

It can use one of the already established ones from the connection pool. Additionally if your already established connections are not enough, it can automatically create more connections to satisfy as much requests as possible. Hibernate has a connection pooling mechanism as standard, but it’s not very useful for production use and for applications that have to deal with freqeunt and time consuming database interaction.

So these are the tools we are going to use on a Windows 7 platform:

  • JDK 1.7
  • Maven 3.0.5
  • Hibernate 4.2.3.Final
  • MySQL JDBC driver 5.1.9
  • Eclipse 4.3 Kepler
  • hibernate-c3p0.4.2.3.Final

The basis of this tutorials is going to be this Eclipse project: HibernateMySQLExample.zip. And it’s based in Hibernate 3 with Maven 2 and MySQL 5 Example (XML Mapping and Annotation)

Hibernate Query


Hibernate Query

In this example we are going to see how to use Hibernate Query Language (HQL). This the query language created for Hibernate. It’s syntax is very similar to a normal SQL lannguage but instead of tables it deals with classes and instead of columns it deals with properties or class attributes. And that’s what makes it really suitable to use it alongside a framework like Hibernate.

So these are the tools we are going to use on a Windows 7 platform:

  • JDK 1.7
  • Maven 3.0.5
  • Hibernate 4.2.3.Final
  • MySQL JDBC driver 5.1.9
  • Eclipse 4.3 Kepler

The basis of this tutorials is going to be this Eclipse project: HibernateMySQLExample.zip. And it’s based in Hibernate 3 with Maven 2 and MySQL 5 Example (XML Mapping and Annotation). All the code snippets displayed here reffer to App.java file of the aforementioned project.