Cayenne PetStore

Skip to end of metadata
Go to start of metadata


cayenne-petstore is a classic Petstore Java application implemented with Cayenne and Struts. By default application uses embedded Apache Derby database.


The current version is a quick port from iBatis JPetstore-5.0 application. In its current reincarnation the application works but is not very polished. We demonstrated that porting to Cayenne is easy, even given the unfriendly DB design, however it definitely needs a rewrite and DB redesign before we can call it Cayenne Best Practices Demo.

Trying Out

Download full Eclipse project or just the war file and drop the war in your favorite web container (in the full download war file is located under cayenne-petstore/dist directory).

Note that by default Derby (db engine used by cayenne-petstore) will attempt to create a database in the JVM java.io.tmpdir (whatever that is from the web container perspective; Tomcat puts the database in $CATALINA_HOME/temp/). If you want a different location, unpack the war file and edit WEB-INF/classes/derby.properties setting derby.system.home to an absolute path.

If you want a different database alltogether, open "WEB-INF/cayenne.xml" file in CayenneModeler and do the needed changes (of course you can do them by hand as well).

Inspecting Source Code

Petstore is a valid Eclispe project, so simply import it in Eclipse.