Jasper

Jasper

(0 comments, 17 posts)

This user hasn't shared any profile information

Posts by Jasper

Scaling: who needs EJB anyway

In this nice OnJava article Amir Shevat shows a way to scale an application in a near painless and lightweight manner using the OS MantaRay messaging middleware package.
Interesting how this compares to EJB or Webservices (and WSIF) – when deployed to fix the scaling problem -, by keeping the ‘S’ in KISS.
The first one, that is.

XSLT is Way Faster Using Java 5

Interesting post by Dino Fancellu on SoftwareReality.com, XSLT is Way Faster Using Java 5, talks about how by replacing Xalan by XSLTC and Crimson by Xerces Sun JDK 5.0 (1.5.0_01) is 5.59 times faster than Sun JDK 1.4.2 when performing a simple transformation. JRockit 5, BEA’s own Java 5 compatible JVM, does it even 7.88 times faster!
And it’s free, so it may be worth a look?

jWebUnit

During my current project, i encountered jWebUnit, a unittesting framework based on jUnit and HttpUnit. Old news for some, new for me.
Since we already had some posts on jUnit and HttpUnit, i thought this might be of interest.
An example of its conciseness (as found on the jWebUnit homepage):
(more…)

Using Struts' nested indexed properties in a form with table-layout

It looks like trying to use Struts’ nested indexed properties in a form with table-layout, with every line (a few formfields) as an editable separate entity, has driven a lot of people (including me) nuts.
With nothing about it in the manual, and no answers to be found on the web, here’s finally a solution. (more…)

Easy toString/equals/hashcode

A simple, standard and reusable way of creating toString, equals and hashcode methods in your classes/beans can be found in the jakarta commons.lang package:

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
public class BaseBean {
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }
    public boolean equals(Object o) {
        return EqualsBuilder.reflectionEquals(this, o);
    }

    public int hashCode() {
//             EDIT: this hashCode-implementation seems to break Hibernate:
//             it throws a LazyInitializationException
//    return HashCodeBuilder.reflectionHashCode(this);
//
//             using this implementation for now
        return new HashCodeBuilder(25, 71) // random odd numbers
                .append(this.getId())  // a field in BaseBean, not shown for brevity
                .append(super.hashCode()) // using the standard hashcode too
                .toHashCode();
    }
}

New Oracle JDBC driver

After getting a weird NullPointerException using Transaction.commit() in Hibernate during an insert (eventually calling PreparedStatement.clearParameters() which was the source of the exception), it turned out that the JDBC driver in classes12.jar is outdated, and will not work on JDK1.4 and an Oracle 10g database.
Download the new drivers here to prevent unsuspected errors such as this one..

Hibernate kickstart

A quick’n dirty tutorial-by-example for Hibernate:
(Using one table, an Oracle9+ database and Hibernate2)

1) download the Hibernate distribution

2) put these jarfiles in /WEB-INF/lib:

hibernate2.jar (hibernate core)
cglib-full-2.0.2.jar (runtime class-enhancing)
dom4j-1.4.jar (xml reading)
ehcache-0.9.jar (objectcache)
c3p0-0.8.4.5.jar (connectionpool)
jta.jar (transactions)
(more…)

Some Hibernate links to get started

Some links to get started with Hibernate:

EJB threshold

Years ago, i believe Q4-2000, we made a website that almost from the day it went live had to serve some rather heavy content with 30.000 hits a day. We finally settled on a cluster of 3 Tomcat-4 servers, 2 MySQL DBs, some homebrewed caching (site was read-mostly), some light TX-management and straight JDBC with (cached) prepared statements. That’s it. Surprisingly, the performance was great!
Nowadays EJBs would probably be used for this, but i’m still not convinced why.

I have the feeling that there is indeed some threshold in the level of importance of a managed environment/container for a project, above which the use of EJBs over other frameworks is justified, but i believe the threshold is much higher than should be expected from the percentage of applications using them.
Any thoughts on this?

O/R mapping tools – comparison

For a very extensive comparison between seemingly all the O/R mapping tools known to mankind check this wiki page.
Perhaps a relevant observation: despite the zealoting, Toplink, OJB and Hibernate (by far _the_ most popular ORM-tool, and the basis for EJB3) all seem to offer roughly the same functionality. And actually, the XML configfiles also don’t look all that different to me either..

Some notable differences/facts:

  • Hibernate has a big following, development continues at a rapid pace. Free, OS, but no GUI except for some crude 3rd party tool
  • OJB has a JDO implementation, the other two have not (for what it’s worth, since the JDO movement seems to be running out of steam). Also OS and free as in beer. GUI under development.
  • Toplink doesn’t support MySQL, PostgreSQL or SAP-DB like the other two. It does have a pricetag but also a nice GUI
Jasper's RSS Feed
Go to Top