Blog Archives

Emebedded Databases

We have the following choices: H2 Written in Java 1.5 MB jar Handy cheat sheet driver –> org.h2.Driver jdbc url –> jdbc:h2:~/test hibernate.dialect –> org.hibernate.dialect.H2Dialect HSQLDB (HyperSQL) Written in Java 700 KB jar Apache Derby DB (JavaDB) Written in

Tagged with: , ,
Posted in Database, Hibernate, Java

Hibernate in Action

Hibernate usage: Session session = … Transaction tx = session.beginTransaction(); Pojo pojo = new Pojo();; tx.commit(); session.close(); Interfaces: Session – represents a unit of work with the database, load & save objects Transaction – sets transaction boundaries Configuration –

Tagged with: , , ,
Posted in Hibernate

Hibernate In Action

Notes from ‘Hibernate in Action’: Chapter 1: The Paradigm Mismatch Granularity – SQL databases only support two levels of granularity : tables & columns Subtypes – SQL databases have no notion of inheritance, a foreign key constraint refers to exactly

Tagged with: , ,
Posted in Hibernate, Java

Hibernate Configuration

The following uses Spring + Hibernate:     <bean id=”dataSource”         class=”…”         p:driverClassName=”com.mysql.jdbc.Driver” p:url=”jdbc:mysql://localhost:3306/products”         p:username=”…” p:password=”…” /> The datasource class will depend on desired features: 1) org.springframework.jdbc.datasource.DriverManagerDataSource 2) com.mchange.v2.c3p0.ComboPooledDataSource 3) org.apache.commons.dbcp.BasicDataSource 4) org.springframework.jdbc.datasource.SingleConnectionDataSource Next we define

Posted in Hibernate, Java