Java/J2EE Discussion Forum

Discussion DashboardCategory: JavaJava/J2EE Discussion Forum
DHARMEDRA SAHU Staff asked 9 years ago

“Core Java” is Sun’s term, used to refer to Java SE, the standard edition and a set of related technologies, like the Java VM, CORBA, et cetera. This is mostly to differentiate from, say, Java ME or Java EE.

6 Answers
Best Answer
DHARMEDRA SAHU Staff answered 9 years ago

What’s the difference between JPA and Hibernate?

DHARMEDRA SAHU Staff replied 9 years ago

As you state JPA is just a specification, meaning there is no implementation. You can annotate your classes as much as you would like with JPA annotations, however without an implementation nothing will happen. Think of JPA as the guidelines that must be followed or an interface, while Hibernate’s JPA implementation is code that meets the API as defined by the JPA specification and provides the under the hood functionality.

When you use Hibernate with JPA you are actually using the Hibernate JPA implementation. The benefit of this is that you can swap out Hibernate’s implementation of JPA for another implementation of the JPA specification. When you use straight Hibernate you are locking into the implementation because other ORMs may use different methods/configurations and annotations, therefore you cannot just switch over to another ORM.

DHARMEDRA SAHU Staff replied 9 years ago

JPA itself has features that will make up for a standard ORM framework. Since JPA is a part of Java EE spec, you can use JPA alone in a project and it should work with any Java EE compatible Servers. Yes, these servers will have the implementations for the JPA spec.

Hibernate is the most popular ORM framework, once the JPA got introduced hibernate conforms to the JPA specifications. Apart from the basic set of specification that it should follow hibernate provides whole lot of additional stuff.

DHARMEDRA SAHU Staff answered 9 years ago

How to initailize byte array of 100 bytes in java with all 0’s

DHARMEDRA SAHU Staff replied 9 years ago

The more general approach to initializing is to use the Arrays class.

import java.util.Arrays;

byte[] bytes = new byte[100];
Arrays.fill( bytes, (byte) 0 );