A little background first. In the EJB2.x time, the EJB container was doing all the dirty work : managing session beans, message-driven beans and entity beans. From EJB3, managing session beans, message-driven beans was left to the EJB container, whereas entity beans were removed from the core EJB specification. The management of the new Entities is now the responsability of JPA containers. If you plan to use EJB3 and JPA, you need both an EJB container and a JPA container.
why we need EJB3, Hibernate to achieve persistence in Java.
You don't. You can use JPA with J2SE. You can use Hibernate (JPA container) only to persist entities. [ November 19, 2008: Message edited by: Christophe Verre ]
JPA is actually part of the EJB3 specification, but in a strange twist of logic on someone's part, it's allowed to be implemented in non-EJB environments.
You don't actually need EJB or any other ORM framework (Hibernate, JDO, etc.) to achieve persistence in Java. You can use raw JDBC. However the ORM frameworks provide a boost in productivity, make it easier for people whose primary skills are in Java and not SQL to work with databases, and can actually be more efficient when you scale up than manual JDBC code generally permits.
JPA is a convergence of the 3 major ORM platforms: EJB, Hibernate and JDO. It offers the advantage that you can take JPA code and back it with EJB when using a JEE container and also use the same code in non-EJB environments like J2SE applications.
An IDE is no substitute for an Intelligent Developer.