Hello,

I want to use the JDBC Support by using the NamedParameterJDBCTemplate in combination with the MapSqlParameterSource.

Lets say I have a DB-Table with userdata. I want to get one user like that :

SqlParameterSource param = new MapSqlParameterSource("userid",1);

That works fine and I get the data of user 1. But now I want to make a custom UserId Class. Lets say like

public class UserId {
protected Long id;

public Long getId() {
return id;
}

public void setId(long id) {
this.id = new Long(id);
}
}


At the moment I have to use it like

SqlParameterSource param = new MapSqlParameterSource("userid",userId.getId());

to work. But how can I use it like

SqlParameterSource param = new MapSqlParameterSource("userid",userId);

I tried by overwriting the toString() Method and/or by adding "Implements Serializable" to the classdefintion - but I always get an exception and it does not work.

Any one can help me?

Thanks alot!

Regards, Heiko