MyBatis, MySQL and Zero Dates

I was using MyBatis together with MySQL, now I kept getting something like 13:42:32.681 [main] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource Exception in thread "main" org.springframework.dao.TransientDataAccessResourceException: ### Error querying database. Cause: java.sql.SQLException: Value ' 6181070861^L39078830@N04^S0000-00-00 00:00:00 13.371369 52.515972^@^@' can not be represented as java.sql.Timestamp ### The error may exist in de/uniwue/dmir/flickr/db/mapper/FlickrMapper.java (best guess) Continue reading →

Java: ExecutorService and Shutdown Hook

I was trying to register a shutdown hook to let an ExecutorService finish before shutting down the application. This is how I did it:   public static final long SETTINGS_SHUTDOWN_TIMEOUT = 15; public static final TimeUnit SETTINGS_SHUTDOWN_TIME_UNIT = TimeUnit.MINUTES; public static final TimeUnit SETTINGS_PROCESSOR_TIME_UNIT= TimeUnit.SECONDS;   public static void main(String[] args) {   // initialize Continue reading →

Java: Collections.emptyMap() casting

When using the constant Collections.EMPTY_MAPCollections.EMPTY_MAP Java always complains about "Type Safety" and "Uncchecked conversions". Well something I did not know was that methods can be paramterized like this: Collections.<String, Long> emptyMap()Collections.<String, Long> emptyMap() Of course this works for other methods as well.

Java Image Filter

This seems to be a quite good adress when starting out using image filters in java: http://www.informit.com/articles/article.aspx?p=1013851&seqNum=1 And chapter 12 of this little link should give a few insights about the procedures running under the hood: http://docs.rinet.ru/JaTricks/index.htm

MySQL: How te get last autoincrenment id.

There are three ways using java: http://dev.mysql.com/doc/refman/6.0/en/connector-j-usagenotes-basic.html#connector-j-examples-autoincrement-getgeneratedkeys This is the one I prefere, because the value is scoped by the Statment instance, hence only overwritten when I reuse the specific Statement: Statement stmt = null; ResultSet rs = null;   try {   // // Create a Statement instance that we can use for // Continue reading →

Install java on ubuntu / switch verisons

I am a linux noob. So what? Here is what I found searching the net how to switch java versions on Ubuntu: It is so easy to install Java on Ubuntu now. On Ubuntu 7.04 (Feisty Fawn), follow these steps: 1) Make sure you have the right repositories on your sources.list file. Edit your sources.list Continue reading →

Classpath entry will not be exported or published

Classpath entry will not be exported or published. Runtime ClassNotFoundExceptions may result. This is an error I get when I use Eclipse 3.3.2 with WTP 2.0.6. I added a few libraries to my BuildPath. I found somebody having the same issues: Hi, I have an Eclipse project that I have converted over to be a Continue reading →