Welcome to Crudelia!


(site under construction)

What is Crudelia?

Crudelia, in conjunction with Hibernate, provides a web application with the ability to update/delete/create objects in the database or to put in the http request/session/context objects retrieved from the database, without the need to write a line of code.

It is written in Java and it can be used only in web applications that utilize Hibernate as persistence mechanism. It can be easily integrated with any web framework (Struts, WebWork2, The Spring Framework…) or in a custom web application, for example in a plain servlet/jsp environment, because it has no dependency (except Hibernate). Anyway plug-ins and helper classes for the most common web frameworks are provided.


In a regular web application CRUD (create, read, update, delete) operations are implemented using common patterns. For example a read operation (sql "select" statement) to retrieve all orders made by an user is usually composed by these steps:
  1. Writing of the handler for the request (example "get_orders.do"). When using a framework this means one has to write an whole class (usually composed by just one method) or a new method. Using plain servlets one has to write a new servlet (or a method into an existing one).
  2. Construct the sql query based on values from the http request (userid in our case).
  3. Transform the result of the query into Java objects
  4. Put the result of the query into the request.
Using Hibernate point 3) is already done by the O/R mapping mechanism Hibernate provides. Steps 1), 2) and 4) are usually simple but:
  • they require a new class/method for each CRUD operation. Usually this class does little work, in the example of the orders list it could be something like:
    	int userID = Request.getParameter("userid");
    	List ordersList = myDAO.getOrderList(userID);
    	Request.put("orderlist", orderList);
    Classes like the one above are difficult to maintain (an application can have hundreds of classes like that) and contain hard-coded variables names ("userid" and "orderList" in our case).
  • They require a new DAO object operation that is usually a simple query executor:
    Class MyDAO {
    	public List getOrderList(int userID) {
    		// only code to execute hibernate query
  • if one wants to store the list using the session context instead of the request context he/she has to re-compile the code.
  • Some operation are reused throughout the web application. The only way to have the list of orders in other request handlers is to replicate the code above or use "chained requests" or servlet filters.
  • The only way to test the code of the handler is via http. With crudelia, you can write a configuration entry like:
    <crudelia-action name="get_orders">
    	<find desc="find orders">
    		<store value="orderList" scope="request"/>
    			<hql>from Orders where user.id=:userid</hql>
    			<named-par name="userid" value="userid"/>
      [other tasks here]
    and Crudelia does all, without the need for a line of Java code. The "find orders" task could be global, that is could be re-used in other actions:
    [definition of the "find orders" task in the global area]
    <crudelia-action name="get_orders">
    <task refid="findOrders" />
      [other tasks here]