Archive for the ‘Uncategorized’ Category

h1

JPA2 Junit4 testing with HSQLDB as in-memory database

January 25, 2010

Followed the steps from this great article –

http://antoniogoncalves.org/xwiki/bin/view/Article/TestingJPA
Only issue is that this article uses EclipseLink instead of hibernate implementation of JPA.
If you are using Netbeans 6.8 and you generated the pom file for the project, please perform the following steps –
1. Comment out the following dependency
javax
javaee-api
6.0
provided
or
javax
javaee-web-api
6.0
provided
(depending upon the type of project you created, web or ejb)
2. Add the following exclusion from hibernate-entitymanager artifact
org.hibernate
ejb3-persistence
3. For latest bean validation jsr add the following artifact
org.glassfish
bean-validator
3.0-JBoss-4.0.2_02
and for the persistence apis add the following dependency
javax.persistence
persistence-api
1.0
4. Comment out ejb3-persistence api artifact
org.hibernate
ejb3-persistence
1.0.1.GA
But of course you would have to add the test level dependency for HSQLDB and update the Junit version from old 3.8.2 to latest 4.5
Also for DBunit and dates keep this note handy

DbUnit use the JDBC escape formats for string representation.

Type Format
DATE yyyy-mm-dd
TIME hh:mm:ss
TIMESTAMP yyyy-mm-dd hh:mm:ss.fffffffff
Happy Testing
h1

Too Express or not too express

December 18, 2009

I have been a fan of apple products since my first stint with the first edition of IPod way back in 2005. Recently I have been debating with myslef to setup wireless network for all my devices including two HP laptops and recently purchased two IPhones using either Airport Express/Extreme or a standard linksys or dlink router. Thinking that nothing could go wrong with any of the options I thought of going with Apple Express. The manual says you can setup a wireless network with ease. Belive me it WASN’T. And before I say anything bad about the product I must say this once you have it working you will not regret your descison. Depending upon what problem you have with the initial setup the solution can be different but here I am going to discuss the issue I had and I belive most of the people had (atleast from the reviews on Amazon) is the setting up your new wireless connection which is a pain in the butt. According to the manual you should connect all your wires to the Express before using the Airport Utility. Having done that I thought creating the network should not take long. Actually it shouldn’t have if Apple moved one line from there manual on page 32 to 12. Instead of keeping your DSL powered on while you connect your wires to Express you should power off your DSL modem connect wires to your Express, power on your Express, wait for around 10 seconds and power up your DSL modem. Instead of seeing cool flashing amber light you will see annoying solid green light indicating your Express was able to connect to internet and now you can setup your wireless in express mode. And you will be on board with your Express.

h1

Do people relate “out of the box” with java

December 16, 2009

I don’t why but I thought it will be a fun little excercise to develop a “Hello world” application using jsf2, code name Mojarra. Since most of my current development is on Jboss AS, I thought I would use it as my app container. Nothing to fancy. Since I was in the mood of experimentations I thouht I would use Netbeans instead of regular Eclipse. I set my app server on Netbeans ran the wizard to create a web project using jsf framework. So far so good. Right after that nothing worked. Deployment of a the war failed on number of occassions no matter what configurations I tweaked. Changed jsf libraries to use latest mojarra libraries, used the same libraries with netbeans project (new project). I even went back to my favorite IDE Eclipse and as you might have guessed that didn’t help either. Don’t get me wrong here I am a hard core java/jee developer and I do know my environment quite well. This post I guess is more of a frustration that working on such a powerful programming language and platform requires so much of tweaking of things all over the place starting from IDE to the app container.
I will keep posting my findings until I have found a solution for creating a “Hello World” application.