David has posted 3 posts at DZone. View Full User Profile

jPersist 3.2.7 and jWebApp 4.8.7: Simple Web and ORM Framework Alternatives

06.25.2008
| 3066 views |
  • submit to reddit

This release fixes a high profile problem that caused the following exception:

jpersist.JPersistException: Column 'a.column' not found.  
at jpersist.Result.getColumnValue(Result.java:1282)

Everyone using these open-source projects should upgrade to the latest version.

 

Getting Started

jWebApp and jPersist provide a simple alternative to other Java frameworks and RAILs, but don't let the following fool you, there is a ton of functionality provided with jWebApp and jPersist.

jWebApp and jPersist make web development as easy as defining a simple Java class:

    public class Customer extends RequestHandler
{
public String processGetCustomer(ServerInterface serverInterface)
{
String customerId = serverInterface.getParameter(“customerId”);
Customer customer = jpersist.loadObject(new Customer(customerId));

serverInterface.setAttribute("customer", customer);

return "/WEB-INF/customer.jsp";
}
}

...and creating a view with plain HTML and your favorite template markup (JSP, Velocity, etc):

    <div align="center">
<h3>Customer ${customer.firstName}, ${customer.lastName}</h3>
...
</div>

...and then calling:

    http://host/context/customer/getCustomer?customerId=jsmith

The following servlet configuration is all that is needed:

    <servlet>
<servlet-name>jwaRequestServlet</servlet-name>
<servlet-class>jwebapp.RequestServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>jwaRequestServlet</servlet-name>
<url-pattern>/customer/*</url-pattern>
</servlet-mapping>

That's it! No other XML, annotation, or configuration is needed!

Is there an easier way?

0
Published at DZone with permission of its author, David B..

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Thomas Mueller replied on Wed, 2008/06/25 - 5:49am

There are many new persistence APIs coming up lately. I think that's great! I am trying to write a Java version of DLINQ. Example:
Customer c = new Customer();
List<Customer> waCustomers =
  db.from(c).
  where(c.region).is("WA").
  select();
See also other code samples

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.