18 January 2009

Seam JPA - Manual Flush

In Seam, (only) when using Hibernate as the underlying JPA implementation, we have the option of flushing manually to the database. One possible scenario where we may apply this is during batch update, as we may not want to accumulate and push all DB update till the end.

Below is an example, how to configure it using annotation
@Begin(join=true,flushMode=FlushModeType.MANUAL)
public void methodWhereSomeThingStarts() {


and in the method that ends the conversation, we can use

@End
public void methodWhereBatchUpdateAndConversationCanEnd() {
//Iterating loop
em.flush();

Note: em is javax.persistence.EntityManager

10 January 2009

How to find a String or text value in specific type of files in Linux

I am not trying to post a grep or find reference manual but the below command will come handy in the following situations, (when searching in Java files)
  1. To search for TODO in code
  2. To search for System.out.println in code
Of course Eclipse or NetBeans will display this but I find my Ubuntu searching and displaying the results at lightning speed.

find . -name "*.java" |xargs grep TODO