When working with Hibernate and nested domain object models, it can be a performance problem when trying to display several (including nested) properties in a view. Usually for such cases the use of view objects is practical.
This is the first scetch of my idea to automate population of view objects with hibernate.
»more…
|
|
# |
I just recognized that there is no convenient method in Javascript to format a date-object to a string with the help of a dateformat-pattern, like in java.text.SimpleDateFormat. So I have writen a simple method, which just does this, including most important patterns.
»more…
Usefull and thus noted:
In one of my current workprojects I had a registrationform the user filled. After formvalidation, I wanted to login the user automatically. This can be achieved in Spring / Acegi quite easy:
»more…
Derzeit arbeite ich viel mit Java 1.5. Durch das Interface Iterable kann man hier die kurze Schleifenvariante
Collection c = ... for (final Object o:c){ ... }
einsetzen, die genauso auch für Arrays funktioniert.
Was jedoch nicht geht, ist das Hinzufügen von Arrays in Collections via collection.addAll(anArray);.
Hier hilft meine kleine Utilityklasse Collections weiter, die auch die Collection zurück liefert.
Zwei Dinge, die man bei java.util.Collections leider nicht bedacht hat…
»more…
Hibernate unterstützt in der Criteria API bei der Angabe von Properties für Criterions oder auch Sortierungen lediglich die Angabe von Properties der Tiefe 1.
Beispielsweise ist criteria.addOrder(Order.asc("id")) möglich, jedoch criteria.addOrder(Order.asc("parent.id")) oder gar criteria.addOrder(Order.asc("parent.parent.id")) nicht möglich.
Um diese Abbilden zu können, muss man sich einiger Joins oder Aliase bedienen.
Im folgenden wird dies anhand der Sortierung gelöst.
»more…
Few snipplets making the usage of hibernate with annotations within spring easier.
»more…
Kürzlich geschrieben und als nützlich empfunden:
Ein Comparator für Files, der eine natürliche Reihenfolge schafft, Nummernprefixe in Dateinamen ihrem Wert entsprechend sortiert, also z. B. "1.jpg", "2.jpg", "11.jpg", "a.jpg", was bei alphabetischer Sortierung (wie in den meisten Betreibssystemen eingesetzt) zu "1.jpg", "11.jpg", "2.jpg", "a.jpg" wird.
In some cases it’s usefull to concat the values of BeanProperties when using the BeanUtils from Apaches Commons. I just extended some few functionality to achiev this within the property-identifier itself.
»more…




