Creating a simple MySql Table: CREATE TABLE `YairShinar`.`employee` ( `idemployee` INT NOT NULL , `firstname` VARCHAR(45) NULL , `lastname` VARCHAR(45) NULL , PRIMARY KEY (`idemployee`) ); Creating the JPA annotations and imports package com.YairShinar.jpa.entities.Employee; import java.io.Serializable; import javax.persistence.*; @Entity public class Employee implements Serializable { @Id private int idEmployee; privateContinue Reading

JAX-B is the xml modeling for Java. It makes it easier to marshell classes. import javax.xml @XmlRootElement public  class  Book{ private string isbn; }Continue Reading

Object Model Api: The model creates an object in memory thus enabling easy navigation and creation: Example of easy navigating: Java import javax.json.Json; import javax.json.JsonObject; Path file = Paths.get(“book.json”); InputStream stream = Files.newInputStream(file); try(JsonReader reader = Json.createReader(stream)){ JsonArray array= reader.readArray(); for(int i =0 ; i < array.size(); i++){ array.getJsonObject(i).getInt(“id”); }Continue Reading

The Java Message Service (JMS) API is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients. It is an implementation to handle the Producer-consumer problem in order to create, send, receive, and read messages, It allows the communication between different components of a distributedContinue Reading

A socket connection means that two machines have information about each other’s network location IP Address and TCP port, and that they can send or receive data through the connection. In order to create a socket server: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; publicContinue Reading

A Servlet is an object that receives a request and generates a response based on that request. To deploy and run a servlet, a web container must be used such as TomCat/JWS/Jetty/Resin. In order to create a servlet the class must extend servlet. The package javax.servlet.http defines HTTP-specific subclasses ofContinue Reading

JAX-RS stands for: Java API for RESTful Web Services ,hence it is a http uniformed verb based service. Some of The main annotations in JAX – RS: @Path : specifies the relative path for a class or method @GET/@PUT/@POST/@DELETE/@HEAD: Indicates the http request type on the method but only oneContinue Reading

JAX-WS stands for Java API for XML Web Services. Creating a Service Endpoint Interface (SEI) package com.yairshinar.ws; import javax.jws.WebMethod; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPBinding.Style; @WebService @SOAPBinding(style = Style.DOCUMENT) public interface HelloName{ @WebMethod String getName(String name); } Creating a Service Implementation Bean (SIB) that implements all the methods of theContinue Reading

A thread in most cases is a component of a process, and shares it’s resources. In Java – Creating a basic thread and starting it: (This Example doesn’t provide any code in the start method. So the thread will exit right after it is started). Thread thread = new Thread();Continue Reading

Thread Synchronization is basically suspending (making one thread wait) until the other thread meets a certain condition. Now some of you know the regular Join(), which suspends the calling thread until the called thread meets the condition of finish. But , I would like to take a look at theContinue Reading