background preloader

Server

Facebook Twitter

MongoDB Presentations - Online Conference: Deep Dive with MongoDB. Doing REST Right. The Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIs. Java XML & JSON Binding: Creating a RESTful Web Service - Part 1/5. (1) What's the best RESTful web framework to use with Java. Chapitre 1. Exemple simple utilisant Tomcat. Chapitre 1. Exemple simple utilisant Tomcat 1.1. Vos débuts avec Hibernate Ce tutoriel détaille la mise en place d'Hibernate 2.1 avec le conteneur de servlet Apache Tomcat sur une application web. Hibernate est prévu pour fonctionner à la fois dans un environnement managé tel que proposé par tous les plus grands serveurs d'applications J2EE, mais aussi dans les applications Java autonomes.

Bien que le système de base de données utilisé dans ce toturiel soit PostgreSQL 7.3, le support d'autres bases de données n'est qu'une question de configuration du dialecte SQL d'Hibernate. Premièrement, nous devons copier toutes les bibliothèques nécessaires à l'installation dans Tomcat. Maintenant, copions les bibliothèques dans les deux classpaths : Copiez le pilote JDBC de la base de données dans le classpath global.

Tableau 1.1. Nous allons maintenant configurer le pool de connexions à la base de données à la fois dans Tomcat mais aussi dans Hibernate. <? 1.2. 1.4. Using Hibernate with Tomcat. If you use Hibernate on Tomcat you don't have to use Tomcat's JNDI-bound JDBC connections. You can let Hibernate manage the JDBC connection pool. This works on all versions of Tomcat and is very easy to configure. First, create a hibernate.cfg.xml or hibernate.properties file, as per documentation (no, property names in cfg.xml don't have to be prefixed with "hibernate.xxx"): <! <! DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" " Settings for a local HSQL (testing) database.

Now copy this file into your WEB-INF/classes directory of your web application. Start Hibernate by building a SessionFactory, as shown here with HibernateUtil. This listener initializes and closes Hibernate on deployment and undeployment, instead of the first user request hitting the application: Add it to your web.xml: MyBatis. What is MyBatis? MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings.

MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records. Help make this documentation better… If you find this documentation lacking in any way, or missing documentation for a feature, then the best thing to do is learn about it and then write the documentation yourself! Sources of this manual are available in xdoc format at project's Git Fork the repository, update them and send a pull request. You’re the best author of this documentation, people like you have to read it!