Welcome to Java4u

A Single Place for all Java Resources

Looking for something?

Subscribe to this blog!

Receive the latest posts by email.

.Just enter your email below if you want to subscribe!


OAuth 2.0

OAuth 2.0 is an open authorization framework and mainly focuses on authorization flows fand secures access to many well-known web APIs.

Java 8 features

The key features of JDK 8 are Project Lambda (JSR 335), the Nashorn JavaScript Engine, a new Date and Time API (JSR 310), a set of Compact Profiles and the removal of the "permanent generation" from the HotSpot Java Virtual Machine (JVM). A complete list of the new features and capabilities of JDK 8 is available.

Lambda Expression

A lambda expression represents an anonymous function. It comprises of a set of parameters, a lambda operator (->) and a function body.


SOAP : Web service use XML messages that follow the Simple Object Access Protocol (SOAP) standard.
RESTful : Web service, often better integrated with HTTP than SOAP-based services are, do not require XML messages or WSDL service–API definitions.

Softwares Engineering / SDLC

Software engineers apply the principles of engineering to the design, development, maintenance, testing, and evaluation of the software and systems that make computers or anything containing software work.

Tuesday, September 30, 2014

AngularJS : Introduction and Hello example

Angular JS is a JavaScript MVC framework created by Google that lets you build well structured, easily testable, and maintainable front-end applications that makes it easier to implement RIA web applications.

What is AngularJS?
AngularJS is based on the MVC pattern (Model View Control). Therefore AngularJS separates your RIA application into models, views and controllers.
The views are specified using HTML + AngularJS's own template language.
The models and controllers are specified via JavaScript objects and JavaScript functions.
Thus, the views are specified declaratively, as HTML normally , and the models and controllers are specified imperatively, as JavaScript normally is.
If you don't know the difference between declarative and imperative programming, don't worry. It is not important to know before learning AngularJS. Besides, it is pretty simple to find the definition on the web.

And Why Should I Use It?

  • If you haven’t tried AngularJS yet, you’re missing out. The framework consists of a tightly integrated toolset that will help you build well structured, rich client-side applications in a modular fashion—with less code and more flexibility.
  • AngularJS extends HTML by providing directives that add functionality to your markup and allow you to create powerful dynamic templates. You can also create your own directives, crafting reusable components that fill your needs and abstracting away all the DOM manipulation logic.
  • It also implements two-way data binding, connecting your HTML (views) to your JavaScript objects (models) seamlessly. In simple terms, this means that any update on your model will be immediately reflected in your view without the need for any DOM manipulation or event handling (e.g., with jQuery).
  • Angular provides services on top of XHR that dramatically simplify your code and allow you to abstract API calls into reusable services. With that, you can move your model and business logic to the front-end and build back-end agnostic web apps.
  • Finally, I love Angular because of its flexibility regarding server communication. Like most JavaScript MVC frameworks, it lets you work with any server-side technology as long as it can serve your app through a RESTful web API. But Angular also provides services on top of XHR that dramatically simplify your code and allow you to abstract API calls into reusable services. As a result, you can move your model and business logic to the front-end and build back-end agnostic web apps. In this post, we’ll do just that, one step at a time. 
Example : Hello , AngularJS 

Note  : The {{  }} are a declarative way of specifying data binding locations in the HTML. AngularJS will automatically update this text whenever the yourName property changes.

Watch another example

Monday, September 29, 2014

Hibernate Videos

  • Hibernate is an Object-Relational Mapping(ORM) solution for JAVA, providing a framework for mapping an object-oriented domain model to a traditional relational database.
  • It is a powerful, high performance Object-Relational Persistence and Query service for any Java Application.
  • Hibernate maps Java classes to database tables and from Java data types to SQL data types.
  • Hibernate sits between traditional Java objects and database server to handle all the work in persisting those objects based on the appropriate O/R mechanisms and patterns.

Click on the links to Download or Watch

01 - Setup
02 - Setup  
03 - Customize cfg.xml  
04 - Our First Class  
05 - Create table from Class  
06 - Schema Change  
07 - Insert record (object)  
08 - Chapter 1 Review 1  
09 - more annotations

10 - Auto Generate Primary key 
11 - One class to Two tables
12 - Two classes to One table 
13 - Compound Primary Key 
14 - Inheritance Mapping
15 - One to One Mapping 
16 - One to One Bi-directional
17 - One to Many Mapping  
18 - Many to Many Mapping