java Hibernate is a tool that performs the mapping between
oriented world object-world applications and
entity-relationship databases in Java environments. The term used is
ORM (object / relational mapping) and technology is making the transition
a representation of the data in a relational model
an object-oriented model and vice versa. Hibernate
not only does this this transformation but provides capabilities for collecting and storing data from the database that we reduce development time.
the structure of this framework we can see in an article in my blog:
Http://ungranoparajava.blogspot.com/2009/06/arquitectura-de-la-persistencia.html
we will see a small example of this framework with jsp and as always with Netbeans IDE
1 .- create our web project
2 .- assign the name, next and select the hibernate framework and also the basis of data that we will work
2.1-based data have to be registered, as we see in Figure
3 .- add these Two configurations are shown in the hibernate.cfg.xml file
the configuration can be seen in xml format, this is where the settings are saved
the framework.
4 .- let's create the objects related to the data base we select
5 .- now generate the hbm.xml of each table is related to an object of type beans
5.1 Although we have the draft
6 .- generate the kind newhibernateUtil
7 .- generate a class: consulta_empresa, which consists of a constructor and method which provides a Query (obs : hibernate HQL to query occupies)
8 .- Now go to our index and insert this code very simple
0 comments:
Post a Comment