Be aware of Mutliple Result Mappings in JPA!

2

Recently at work, i came across an issue when using @SqlResultSetMapping from JPA (Java Persistence API) to build native queries retrieving result from multiple entities at once. The problem was actually due to a naive usage from me of those result set mappings, in particular when my queries were returning multiple entities with same column names. It took me a little while to figure out what the problem was, so that  I thought i would share this experience with you:

The problem:

Let’s say you have two classes: “Person” and “Car” defined as such:

Person.java:

import More >
jax-rs-spec-logo

Use JAX-RS to create a file download web service

0

Until now,  when i needed to download a file from Server, i systematically  ended up writing a Java Servlet, and overriding its doGet() method.In this method, i first retrieved and checked the request’s parameters. if they were not valid, i threw a exception , otherwise, i used them to fetch the  file to download.Then, i opened an output stream down to the HTTP Response, and i manualy copied the file to it, bytes by bytes.

Code sample:

public class FileDownloadServlet extends HttpServlet { @Override protected void doGet(final HttpServletRequest request, final HttpServletResponse More >
qt-logo

Use custom widgets with Qt Designer: Promotion technique

8

Recently, i’ve been working on a school project (code name: Cute Collage), which consisted in designing a software that creates photo collages. We were asked to reproduce the exact same interface and functionalities as the famous Shape Collage, using the best C++ framework ever: Qt! Qt is a cross-platform application and UI framework. It includes a cross-platform class library, integrated development tools and a cross-platform IDE. Using Qt, you can write web-enabled applications once and deploy them across many desktop and embedded operating systems without rewriting the source

More >
newsite

Launch of the new tinesoft.com today!

3

After several weeks of work , two or three postponements :), i’m very glad to announce the great re-opening of the new  www.tinesoft.com!

As i explained it here, the new Tinesoft, is about tips and tricks for software developers. Please feel free to register to the official twitter account (@tinesoft) and/or RSS feeds to keep informed about the lastest news, tutorials as soon as they get available.

Your comments, suggestions, encouragements? are welcome!

PS: and please, don’t hack my website! 😉

Happy coding folks! 😉

GWT Logo

Create RIA Applications in Java with GWT

0

Haven’t you always wanted to create Rich Internet Applications (RIA) in Javascript/AJAX but renounced to do so because you don’t know anything about these technologies ? Or you do know AJAX, but  managing a code that will work for every web browser out there just drive you nuts. Besides, you find writing a non-trivial Javascript application very painful, given that you can’t debug your program, watch variables, find some errors without running the code, and the list continues. You know very well Java , and has been seduced by it since your write your first “Hello World” program ?

Well,

More >

Apache Maven Logo

Manage your Java projects with Maven

2

There is nothing more irritating than working on a Java project that implies one or more libraries. You need to find and add to your class path, every single *.jar file required by each of them. Sometimes, different libraries rely on the same subsets,  but use different versions. So to avoid conflicts, you need to find the right versions that work for all of them.

A typical example, is a  web application involving Struts, Hibernate, and Spring. It can be a real nightmare to find out the correct set of *.jar files that will make those three frameworks happy. I’m not saying it’s impossible,

More >

Simple Data Binding

Link a Windows Forms Control to an Object: Data Binding

1

Recently, i have been working on this project called EasyCRM. It’s an ASP.NET MVC 2 web application that offers functionalities to manage customer relationship . Anyway, in my application, i had several forms, to create/edit contacts,  accounst, opportunities, tasks, etc. In the form that created a contact for instance, i could attached each of his fields, to the corresponding properties of an  object of my class ‘Contact’. For example, a html input of type ‘text’ was associated to the property ‘FirstName’ of the ‘Contact’ object. When submitting the form, the ASP.NET MVC framework More >

Go to Top