September 23, 2010

In this post I try to explain jpa criteria API by simple example on a single entity. Although examples are pretty much simple it will help you with finalized version of JPA 2.0 API. For Part II please read JPA Criteria API by samples – Part-II and in this examples in my opinion building query […]

Continue Reading
September 21, 2010

Criteria rootCriteria = session.createCriteria(OrderItem.class); Criteria criteria = rootCriteria.createCriteria("order").createCriteria("customer"); List<OrderItem> list1 = criteria.add(Restrictions.eq("city", "city-1")).list(); List<OrderItem> list2 = session.createQuery("select s from OrderItem s where s.order.customer.city=?").setString(0,"city-1").list(); assertEquals(list1, list2); but when you trace the generated SQL you can see the huge difference. it simply changes fetchmode defaults and ignore any manual fetchmode setting SQL from criteria API select this_.id […]

Continue Reading
August 31, 2010

Like Annotations, Generics are also a runtime metadata that you can process at the run time. Here you can see how to traverse the runtime information to get this information. You Can simply traverse the inheritance tree ofr the class and get the metadata of the generic definition. Somthing like First The Sample Cases : […]

Continue Reading
July 20, 2010

[caption id="" align="alignright" width="137" caption="Image via Wikipedia"][/caption] Although it has not been a long time since I started to develop a small rails application, I would like to share notes. the first point ,for me and for all the Java developers like me, should be: “what kind of language is this  ???” 🙂 yes it […]

Continue Reading
July 20, 2010

[caption id="" align="alignright" width="175" caption="Image by valentin.d via Flickr"][/caption] Yesterday while I am trying to organize threads in Java I noticed something strange !! Simply the default ExecutorService  could not manage to recover suspended threads. After a small investigation, it looks like if any of the running thread throws any RuntimeException, ExecutorService may not recover […]

Continue Reading
March 2, 2010

[caption id="" align="alignright" width="240" caption="Image by Neil Crosby via Flickr"][/caption] Seperation of Concepts Inversion Of Control Desing patterns They are all trying to tell you one common thing. Please Make It Simple  and Organized No matter what size is your project and how many teams/developers involved, the complexity if the code has tendency to be […]

Continue Reading
%d bloggers like this: