среда, 13 октября 2010 г.

Java: Hibernate: Основные шаги

1. Identify the POJOs that have a database representation.
2. Identify which properties of those POJOs need to be persisted.
3. Annotate each of the POJOs to map your Java object's properties to columns in
a database table.
4. Create the database schema using the schema export tool, use an existing
database, or create your own database schema.
5. Add the Hibernate Java libraries to your application’s classpath.
6. Create a Hibernate XML configuration file that points to your database and
your mapped classes.
7. In your Java application, create a Hibernate Configuration object that
references your XML configuration file.
8. Also in your Java application, build a Hibernate SessionFactory object from
the Configuration object.
9. Finally, retrieve Hibernate Session objects from the SessionFactory, and write
your data access logic for your application (create, retrieve, update, and
delete).