Everyday there is something new..

Maven filtering.  It would replace the file, containing property, it knows its replacement value.

There seems many maven plugin got this capability. Configure the directory, the files, and filtering equals to true. Then maven will come in do its job.

Google guice is nothing fancy. It’s just an dependency injection tool, as spring parts, however, everywhere there is spring already.

Apache camel and spring integration are similar. Which are enterprise integration pattern, it will link from endpoint to process, to another endpoint.

And some beauty of camel, it can create the component ( the endpoint factory), based on uri.  It can integrate with guice, which can bind endpoint annotation to component provider, so to create customized uri, or customized component. Like jmsus: queue name. Instead of jms:queue name.

Posted from WordPress for Android

ORM – object relation mapping

Team is encountering an exception, “unknown enum value for (some enum class) : (some enum constant name)” kind of exception.

I have been keep debugging, following the stack trace for half a day. And since the stack trace goes so deep, my eclipse crash many times.

This is another reason why I hate persistence, and prefer mybatis.

We should have a control of how we store our object, and what kind of data we wanna retrieve from database. We can decide what’s the update, insert and queries. Instead of leaving to jpa, or hibernate, which might forever won’t be able to be perfect. As they are trying to suit for all kinds of objects.

The exception we encountered, is during the process of retrieving the data. We are trying to get an message object. Then this message object actually linked to an exception object, by the foreign key, exceptionid. Then inside this exception object, there is one property which is an enum type. And this exception again maps to an exception table. (I hate this kind of object, table links, again. And there are too many restrictions in order to make the forever not perfect orm work.)

When retrieving the exception object, the not so famous exception, “unknown enum value for ..” occurred. We have annotated the property as enumerated, and the type as string. And i have tested, enum.valueof(enum lass, enum const name), returns correct. Somewhere, the jpa, hibernate, plus the enumerated annotation breaks down. Probably they need some more restricted setting to tell them, what map to what, and how. Shit.

At the sad time, for debugging process, I have made another conclusion, based on this time experience. I am always stubborn as trying to follow the sequence, follow the order, from beginning to end, wanna know all details, which doesn’t work in some scenarios, and especially during process of debugging such deep stack trace.

Follow the exception, trace reverse should be better solution. put a break point at the exception.

Trace in reverse order!


It turns out, it is not the problem of jpa or hibernate. Instead, it’s the database column type problem. The column is using char 12. So even though enum constant name is stp, only 3 character. However, once put into database, and later wanna retrieve this column, it retrieves as char12, with 9 spaces trailing stp.

Enum.value of(enum class, enum constant name), which us used by hibernate to persist out the data as the enumeration constant, can’t find the enum constant as such.

Google music

Google music is google’s version of cloud music.

I have tried on that, even though on browser only, it works very well. Streaming like on local pc.

Interface rather nice also.

It will auto sync your local music to cloud. At the same time, out of good will, google offer a bunch of free music.

Currently it’s not available to public. However, go to music.google.com, make a request, within one week, they will grant you access.

If you are based in us, there is even an android app for this. I heard it works very well.