Blog Archives

Tomcat Virtual Hosts

I added to my bookmarks, its a website by Rama Krishnnan that contains lots of useful information for configuring Tomcat. Some of my favorites articles include:  Understanding Virtual Host Concept in Tomcat. Deploy multiple domains into a single tomcat (1

Tagged with: , ,
Posted in Java, Tomcat, Web

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

Integration Testing with DB Unit

First checkout DB Unit: DbUnit is a JUnit extension targeted at database-driven projects that, among other things, puts your database into a known state between test runs. … DbUnit has the ability to export and import your database data

Tagged with: , , ,
Posted in Database, JUnit, Testing

Testing with SpringJUnit4ClassRunner

Testing with SpringJUnit4ClassRunner is breeze. First add annotations: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { “/appContext.xml” }) public class SimpleDaoTest{ … } Place resources on classpath: src/main/test/resources Add dependencies: <dependency>     <groupId>org.springframework</groupId>     <artifactId>spring-test</artifactId>     <version>${springframework.version}</version>     <scope>test</scope> </dependency> Annotate test class: @Autowired

Tagged with: , ,
Posted in JUnit, Spring, Testing

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

Why does Spring use Runtime exceptions ?

Interesting dicussion on JavaRanch: Summary: Runtime exceptions don’t force the calling code to handle problems that they cannot recover from. The exceptions are declared in the documentation and can still be caught. Another good article :

Tagged with: , ,
Posted in Java, Spring