Doing EJB-like transactions with Google App Engine

Using Google App Engine you can’t define a method as transactional with a simple annotation as you can in EJB. You always need to call some boilerplate code which gets quite annoying. Therefore the following utility class comes handy, which takes care of the transaction handling for you: https://gist.github.com/marcusschiesser/5474348 To make use of it, you have to set the same persistence unit as in your persistence.xml configuration file first. Do this by changing the parameter of the method createEntityManagerFactory....

January 5, 2013 · 2 min · admin

Using real POJOs (without JAXB Annotations) as transfer objects with JAX-RS

Are you annoyed that you have to annotate your POJOs with @XmlRootElement, so they can be used with JAX-RS? If your using Jersey as JAX-RS implementation your lucky: Just add to the <servlet> tag in your web.xml the following snippet: <init-param> <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name> <param-value>true</param-value> </init-param> After restarting your servlet, your POJOs are marshalled to JSON as a charme. Enjoy!

December 1, 2011 · 1 min · admin

Let the user change the column order in Java/Swing

Do you have the requirement to let the user of your application change the order of his columns and your app is based on Swing? Then you should read further. Below you find a [TableColumnModel](http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/table/TableColumnModel.html) that has two states: STANDARD and USERDEFINED. In the STANDARD state the user may not change the order of the columns by drag’n’drop, in USERDEFINED he may. The good thing: If you toogle the state the column order is restored....

November 18, 2011 · 2 min · admin

Openbahn-API – Bahn-Webseite als Webservice

As this is only of interest for German users - this article is in German only. It’s about a new project of mine. Sorry folks. Ich bin gerade dabei eine Android-App zu entwickeln, mit der es möglich ist Fahrkarten für Bahn-Pendler einfacher zu buchen. Bei der Entwicklung ist mir aufgefallen, dass die Bahn leider keine Webservices nach außen zur Verfügung stellt – die Webseite www.bahn.de ist zusammen mit der mobilen Variante m....

June 22, 2011 · 2 min · admin

Using Axis2 services from Javascript (by removing the XML namespaces)

If you want to call an Axis2 service from Javascript you will face the problem that the XML response of an Axis2 service call contains XML namespaces - something Javascript doesn’t like in cross-browser-friendly way. The idea to fix this issue is to make an XSLT transformation directly from Axis2 that removes the unnecessary namespaces. First we need an XSLT transformation that will do the job: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="no" method="xml"></xsl:output> <xsl:template match="/|comment()|processing-instruction()"> <xsl:copy> <xsl:apply-templates></xsl:apply-templates> </xsl:copy> </xsl:template> <xsl:template match="*"> <xsl:element name="{local-name()}"> <xsl:apply-templates select="@*|node()"></xsl:apply-templates> </xsl:element> </xsl:template> <xsl:template match="@*"> <xsl:attribute name="{local-name()}"> <xsl:value-of select="....

January 27, 2009 · 2 min · admin