Stephane Eybert

Ranch Hand
+ Follow
since Mar 15, 2010
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Stephane Eybert

I solved the issue by using the TypeResolver of TypeTools from Jonathan Halterman at

Here is the code chunk I used:

Thanks to you Jonathan !
11 years ago
Hi Paul,

Thanks for the comment. Here is the class source code. The line "41" is at line 12 in this post.

11 years ago

I have the following classes...

A generic DAO class:

A domain DAO class extending the generic DAO class:

A database server specific domain DAO class extending the domain DAO class:

The compile is perfectly happy with the above.

But running the test demo class:

gives the following exception:

Exception in thread "main" java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
at com.thalasoft.learnintouch.core.dao.hibernate.GenericHibernateDao.<init>(
at com.thalasoft.learnintouch.core.dao.hibernate.UserHibernateDao.<init>(
at com.thalasoft.learnintouch.core.dao.h2.hibernate.UserCustomHibernateDao.<init>(
at com.thalasoft.learnintouch.core.exception.TestDemo.main(

Any clue ?
11 years ago
Hi Rob,

I know, I feel the same, that's why I'm right now still looking at it, trying to dig around..

I don't know what happened, but the issue does not show up anymore.
Hello Rob,

I just see your last post, sorry for not having seen before, strange because I made sure to refresh the page before my last post.


12 years ago
I tried a new take, this time not using the enum construct.

12 years ago
I think the preferences of one module should sit in an array so as to be traversable and displayed in a list.
12 years ago
I tried to come up with a design but I'm mildly satisfied with my production here.

So here is what I did.

There is a common Preference class:

Which is used by other Preference classes, each for a module of the application:

The application module can then read the preference value with:

I don't know why, but I don't like it.
12 years ago
Ok Rob, I shall try that road then, cheers.
12 years ago
I could skip the enum then.

Any design advice ?
12 years ago
Thanks Rob. I used the ResourceBundle class in the past.

My issue lies more with the constants and how to load them:

I guess I could have in each module, an enum along the lines of:

public enum Preference {

DOCUMENT_NB_PER_ROW("My label1", "My help1", PREFERENCE_TYPE_RANGE, array(1, 10, 3)),

private String label;
private String help;
private int type;
private Array possibleValues;

Preference(String label, String help, int type) {
this.label = label; = help;
this.type = type;

Preference(String label, String help, int type, Array possibleValues) {
this.label = label; = help;
this.type = type;
this.possibleValues = possibleValues;

public String getLabel() {
return this.label;

public String getHelp() {

public String getType() {
return this.type;


As I would have such an array in each module of the application, would it be possible to have each enum class extend on a common one ?

Something like an enum extending anoterh base enum:
12 years ago

I have a legacy php application which has multiple modules, each one having a set of preferences supporting language localized strings.

For example, the "document" module has the following preferences:

The language text strings are stored in text files sitting in the file system next to the script like:


Here is the content of one such language text file:

[ 0]Document to download:
[ 1]Download the document
[ 2]Ref:
[ 3]Download
[ 4]Display all the documents:
[ 5]By default, when no category has yet been selected by a visitor of the website, only the documents of the first category are displayed.\n\nBut it is possible to display all the documents instead of only the ones of the first category.
[ 32]Number of documents per row:
[ 33]The lists of documents can display several documents per row.\n\nThe number of documents per row can be modified.\n\nThe number of images per row can be modified.
[ 6]Hide the selector:
[ 7]By default, a category selector is displayed on top of the list of documents.\n\nBut this selector can be hidden to prevent the selection of another category.

The preferences values are stored in a database table:

mysql> desc preference;
| Field | Type | Null | Key | Default | Extra |
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| version | int(10) unsigned | NO | | NULL | |
| name | varchar(50) | NO | UNI | NULL | |
| value | text | YES | | NULL | |
| type | int(10) unsigned | NO | | NULL | |
5 rows in set (0.00 sec)

mysql> select * from preference limit 10;
| id | version | name | value | type |
| 1 | 0 | FLASH_INTRO_HIDDEN | 1 | 1 |
| 2 | 0 | FLASH_INTRO_DISPLAY_ONCE | 1 | 1 |
| 3 | 0 | FLASH_INTRO_DISPLAY_PERIOD | 0 | 7 |
| 4 | 0 | FLASH_INTRO_POPUP | 1 | 1 |
| 5 | 0 | FLASH_INTRO_PAGE_BG_COLOR | | 8 |
| 6 | 0 | FLASH_INTRO_SKIP_LINK | | 2 |
| 7 | 0 | FLASH_INTRO_POPUP_WIDTH | 900 | 2 |
| 8 | 0 | FLASH_INTRO_POPUP_HEIGHT | 900 | 2 |
| 9 | 0 | CLOCK_DATE_NUMERIC_FORMAT | %d-%m-%Y | 6 |
| 10 | 0 | CLOCK_DATE_FORMAT | %A %e %B %Y | 6 |
10 rows in set (0.00 sec)

And so now I wonder how to go to code a preference manager that would be compatible with the existing data.

I already have the data access layer in Java including domain class, mutators and finder..

But I still need the coupling with the hard coded names in the code and the languages text strings.

Any tip would be welcome.

Thanks !


12 years ago
I worked around the problem by decoding the variable in the JSP page.

12 years ago

I have a controller building up a url.

The & is not encoded and that is how this url should be.

However, when this url is passed to a model attribute, it ends up being encoded in the JSP view.

Here is the source code of the controller:

The original value was not url encoded as can be seen in the log:

2012-03-20 13:33:52,290 DEBUG [AnnotateController] =============>>> Controller requestUrl: 1&2

But the JSP page shows it encoded:


I would like the framework NOT encoded my url, as I want to encode some parts of it only.

12 years ago