Wednesday, November 26, 2008
The past few months, I've been a very big fan of integration testing because It removes the process where I have to create mock objects for each dao or services and the creation of object and all of its nested objects.
While at work, I realized that integration tests that uses or retrieves an entity from database first, couples the test to the developers database. After getting my test to work on my machine and then move it to another computer with a different database, I'll get a different record or even retrieve a non-existing record which will definitely cause serious problem.
I guess this is the part where unit test becomes useful but the work will be a bit longer since i need to create mock objects, objects and all nested objects.
Tuesday, November 11, 2008
While at work, I had a problem and I need to project my query to look like this:
CONCAT(CONCAT(YEAR(documentDate), "_"), MONTH(documentDate))
Since hibernate doesnt support mysql or database specific queries, I needed to use Project.sqlProjection to customize my projection list. Anyway the code looks like this:
final Criteria c = session.createCriteria(JobServiceBill.class);
final ProjectionList projectionList = Projections.projectionList();
final StringBuilder sb = new StringBuilder();
sb.append("CONCAT(CONCAT(YEAR(documentDate), \"_\"), MONTH(documentDate)) AS yearMonth");
final Projection distinctYearMonthProj = Projections.distinct(Projections.sqlProjection(sb.toString(),
new String[] {"yearMonth"}, new Type[] {Hibernate.STRING}));
projectionList.add(distinctYearMonthProj);
c.setProjection(projectionList);
return c.list();
Tuesday, November 04, 2008
I'm not sure If I'm the only one who feel that the date/time module in python 2.5 is very hard to use. If any of you ever tried using joda time, you'll notice that it's way to easy compared to python's date/time library.
Correct me If i'm wrong but joda time was created by Google guys so I hope that in the near future, python will have a better date/time library (since Google is the main supporter of python).
Tuesday, October 28, 2008
The google app engine roadmap has been publicly released. One of the things that caught my attention was the support for new runtime language. Rumors have been running around that GAE platform will be supporting both java and php but google never confirmed anything.
What if GAE supports PHP?
Both Java and PHP community will be happy but considering that PHP applications can be hosted for as low as 4 USD a month, I dont think people will easily jump from using hosting service to GAE platform.
What if GAE supports Java?
The main reason why people turn away from java is because of the high cost of its hosting. Allowing small java developers/players to host their applications for free will be fantastic.
I created a survey so you can all vote for what you think (and what you want) GAE to support next.
http://www.surveymonkey.com/s.aspx?sm=kSlGNa0ZFh2iKmq5tY7HcA_3d_3d
Saturday, October 18, 2008
The expression factory from sun and apache doesn't allow parameters to be passed on jsf expression. For example:
#{bean.delete(id)}
Being able to do this allows more flexibility because you won't need to pass your id params as hidden input field.
This expression can only be enabled with the use of jboss el expression factory. To enable it, add the following to your web.xml:
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>