Tuesday, September 28, 2010

A fundamental question about JPA

A fundamental question for many Java developers is "Why JPA? Why do I need to know how to use this API when object-relational mapping tools like Hibernate and Toplink are already available?"

The answer is that JPA is not a new technology; rather, it has collected the best ideas from existing persistence technologies like Hibernate, TopLink, and JDO. The result is a standardized specification that helps you build a persistence layer that is independent of any particular persistence provider.

Monday, September 20, 2010

Issue while starting the server in a debug mode for webapplication.

Hi All

We may get debug launching error while trying to start our server in a debug mode for web application in Web Logic 8.1 or 10.3.

There Could be a Problem with our port number

We have to Make sure that whether we are using correct port number in our eclipse or not. In order to check that go to the startWebLogic.cmd file under the bin dir of your weblogic8.1 or 10.3. There you will find one property called SAVE_JAVA_OPTIONS under this there is a attribute called address. For example in my local mechine I have address=1044. So I have to use 1044 in my eclipse as well.

Monday, September 6, 2010

Have you ever thought the RDBMS is the cause of making your application more scalable

Yes it is true, if your database table size increases to millions of records, SQL will become the main show stopper to make your application more scalable. So the trend is NoSQL and the database which supports NoSQL

Checkout:- http://www.mongodb.org/

Can we write constructors in servlets ?

Ans. Container creates servlet instances using its no-argument constructor. So the answer is Yes, You can write constructor but, if you write a constructor with arguments, you need to provide a no-arg constructor also.

A nice comparison between enterprise messaging providers. expand

We are pleased to announce the publication of a performance comparison of enterprise messaging systems using the JMS API.

We chose a simple set of performance benchmarks to measure throughput with the most common messaging use cases, from lightweight publish/subscribe messaging to persistent point-to-point messaging.

Checkout:- https://community.jboss.org/wiki/HornetQ-thePerformanceLeaderinEnterpriseMessaging

Recommand to check LOGGER.isDebugEnabled when writing log statements....

If you observe most of the members will test the logger level and then they will wrote the logger statements.

Example:- LOGGER.isDebugEnabled or LOGGER.isInfoEnabled

Logger hierarchy ( DEBUG INFO WARN ERROR FATAL )

Let say we have few logger statements in our project.


logger.debug("Sample debug message");

logger.info("Sample info message");

logger.warn("Sample warn message");

logger.error("Sample error message");

logger.fatal("Sample fatal message");

Assume that your logger level is set to INFO then we should only see the message those are

Sample info message

Sample warn message

Sample error message

Sample fatal message

It works fine but it will evaluate logger.debug("Sample debug message"); statement even though it won't print because our logger level is info.

If you take memory and time factor into the consideration then use like this....

logger.debug("Sample debug message");
...........then it won't evaluate logger.debug("Sample debug message"); statement. It will check the condition and terminates because as per our discussion currently INFO is Enabled.

If you got any WARN LIKE Please initialize the log4j system properly

Make sure that your log4j.properties file should me in class folder of your project (or) If you are using any server then it should be in lib folder of that server.

Example: If Tomcat 6, drop it in Tomcat's lib folder and it will apply for all web apps.

Checkout:- http://www.coderanch.com/t/458568/Application-Frameworks/Application-Frameworks/log-j-WARN-Please-initialize

Wednesday, September 1, 2010

Simple method for checking the valid String

public static boolean isValidString(String value) {
if (value != null && value.trim().length() > 0)
return true;

return false;

Simple method for checking the valid collection

public static boolean isValidCollection(Collection collection) {
if (collection != null && collection.size() > 0)
return true;

return false;