ATG Repository web services

Step-1: Include the DAS.WebServices module in your application to enable ATG rest web services to create ATG Repository web services.
Step-2: Flow the screenshot step by step to create Repository Web service    

In DYN Admin use Web Service Administration to get Web Service Creation Wizard

Step-3:Use Repository Web Service to create Repository Web service      
Step-4:Select  the repository componend to create repository  webservices


Step-5 :Select  the Item  discriptor  to create repository  webservices

Step-6 :Select  the method  to get  Item  using repository  webservices
Step-7 :Provide values to create repository  webservices EAR file.



Step-8 :Provide values to create  webservices web Application module. 

Step-9 :Provide values for session and security  to create repository webservices. 


Step-10 :Click on create EAR File to create repository webservices. 
Step-11 :If  EAR File created scucessfully it will give below  success message


Once you have created an EAR file, you must deploy it.

In order to run the Web Service, these additional steps are necessary:
1. Use the runAssembler command to assemble a Nucleus-based application, using the
-add-ear-file  flag to incorporate the contents of the Web Services EAR file.
Step-13 :
 Deploy the assembled EAR file on your application server, and start up the application.
Step-14:

to Browse enabled web service use DynAdmin like below ,it will give list of enabled web services.


Hibernate Configuration on Eclipse with Maven

Step 1: Download the latest software for hibernate configuration.

Step 2: Configure maven 3.2 in your  local environment and execute bellow command on console,this project will create into you user folder.


mvn archetype:generate -DgroupId=com.javawebtutor -DartifactId=HibernateExample -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false



Step 2: open the eclipse and create java project
     Go to à File  à import à Existing Maven Project



Step 2: Click next à finish, you will get bellow screen.


Step 3:Added jar dependencies into pom.xml

 <dependencies>
    <!-- MySQL connector -->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>6.0.5</version>
    </dependency>
    <!-- Hibernate 5.2.6 Final -->
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <version>5.2.6.Final</version>
    </dependency>
  </dependencies>


Step 4: Create a Hibernate configuration file
Create an XML file hibernate.cfg.xml under /resources folder
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
  <session-factory>
    <property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/JAVAWEBWORLD</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">root</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
  </session-factory>

</hibernate-configuration>

Step 5 Then create sample example an execute it.

  See sample example on hibernate

Java Interview Question Part - 3

Q3.What is the difference between an ArrayList and Vector?
Ans:  ArrayList is not thread safe and vector is thread safe because synchronization.
In vector class each method like add(),add(int i) is surrounded with synchronized block,
Both vector and ArrayList hold into their contents. A vector defaults to double the size of
it's array which ArrayList increase it's array size be 50 percentage .
vector is thread-safe that way the performance is slower than ArrayList.

Q2. Defference Between comparable and Comparator in java?
Ans: Comparable and comparator both are the generic interface in java used to compare the data element of object.
Comparable interface is present in the java.lang.package and
comparator interface is present in Java.util package .
The basic difference between Comparable and Comparator interfaces is the comparable interface provides
the single sorting sequence and Comparator interface provide the multiple sorting sequences.
The Comparable interface contains only single method
Public int compareTo(Object obj)  .In Comparator interface contain two methods Public int compare(Object obj1,Object obj2)
and boolean equals(Object obj).

Note: If you want to sorte the objects in natural ordering then you can used the Comparable interface
and If you want to sort objects based in any attribute then comparator interface is used.

Q3.What is the difference between HashMap and HashTable?
Ans: HashMap is not Synchronized in natural but HashTable is thread safe. HashMap is traversed using an iterator, HashTable can
enumerator or iterator. HashMap permit null values and only one null key, while HashTable  does not allow key or value as null.

Q4. What is difference between Enumeration and Iterator in Java?
Ans:Iterator interface introduced in JDK 1.2 and Enumerattion interface is ther from JDK 1.0
In both of the interfaces Enumeration can only traverses the Collection Object and you can not do any modifications to collection while traversing it.
In Iterator you can remove  an element of the colleciton while traversing it.

Q5. What is difference iterator and ListIterator ?
Ans:  Iterator is used for traversing List and Set both but ListIterator to traverse List Only.
We can traverse in only forward direction using Iterator, using ListIterator we can traverse a List in both direction (forward and backword).

In ListIterator using we can add element at any time while traversing.

Q6. Difference between ArrayList and LinkedList ?
Ans: ArrayList internally uses dynamic array to sore the elements and LinkedList internally uses Double Linked List to store the elements.
For manipulatation ArrayList is Slow becuase it's internally uses array and LinkList is faster  because it's uses Double Linked List.

ArrayList is goven good performance in Sorting and Accessing data and LinkedList is better for manipulating data. 

Hibernate - Architecture Overview

In Hibernate Architecture is layered with many object like as transaction factory, session ,session factory ,persistence Object transaction. let's see bellow diagram describe some basic hibernate functionality. 

1. Configuration (org.hibenrate.cfg.Configuration): In this section represent a configuration or properties file for Hibernate.The configuration object created once when application initialization.The configuration object read and make the connection to relational database.
The Configuration object provides two keys factor:

  • Database Connection:This is handled through one or more configuration files support Hibernate.The name of these file are hibernate.properties and hibernate.cfg.xml.
  • Class Mapping Setup: this component create the connection between java class and relation database tables.


2. Session-Factory (org.hibernate.SessionFactory): The Session-Factory is thread-safe as it is created one per database and can be concurrently accessed by multiple threads and created at time of application startup. Session-Factory created using Configuration object.
session-factory can hold an optional (Second level)cache of data that is reusable between transaction at process ,cluster level.

3. Session (org.hibernate.Session) :The Session is used to create object that are used to communicate between java application and persistence store database.This is factory for transaction and it is not thread-safe.Session holds a mandatory first-level cache of persistence object.

4. Transaction (org.hibernate.Transaction) :
Transaction is not thread safe and it is associated with a session and it usually instantiated by call to Session.beginTransaction().

5. Query (org.hibernate.Query):Query Object use SQL or Hibernate Query Language(HQL) string to retrive data from the database and create object.Query instance is obtained by call Session.createQuery().

6. Criteria (org.hibernate.Criteria): Criteria Object are used to create and execute object oriented criteria query to retrieve object.

Hibernate Introduction

Hibernate is popular open source object relation mapping tool for java application. It provide powerful and object relational persistence and query service for java application.

In this Session we will cover bellow points:

 Hibernate Introduction
 Hibernate - History,Feature and Architecture.
 Hibernate Configuration on Eclipse.
 Hibernate - Understanding Sample Example.
 Hibernate - with annotation
 Hibernate - with Mapping File.

Hibernate History ,Feature and Architecture


Hibernate is the ORM tool given to transfer(Send/Retrive) the data between a java (object)application and a database (Relational) in the from of object. It is opensource and light weight tool,
hibernate was started in 2001 by Gavin King with Colleagues from Cirrus Technologies as an alternative to using EJB2-Entity beans.The Main goal was better persistence capabilities than EJB2.
After Some time Jboss,Inc (now a part of Red Hat) later hired the lead Hibernate developers in order to further it's development. 
In 2005 Hibernate version 3.0 was release and included new  intercepter/ CallBack architecture ,user defined filter and JDK 5.0 Annotations
In 2010 Hirbenate veriosn 3.5  a certified implementation of JPA (java persistance API 2.0 Specification) via wrapper.

Feature of Hibernate:

  • Hibernate persists java object into database(Relational) instead of the java primitives data type.
  • Hibernate generates queries for java application to communicate with database.
  • Hibernate provide fine-grained exception handling mechanism.
  • Hibernate provide implicit connection pooling mechanism.
  • Hibernate supports inheritance ,Association and collections.
  • Hibernate support a query language(HQL)which is Database vender independent.
  • Hibernate generate primary keys automatically while we are storing the data into database.
  • Hibernate Support over 30 dialets.
  • Hibernate provide caching mechanism and Lazy loading concept include in hibernate so you can easily load object on start up time

 Architecture Overview:


Hibernate Architecture


Click Here -->

Design Patterns

Design Patterns are very popular among software developers. we can use to solve common problems when designing an application or system.Design patterns can speed up the development process by providing testing,proven development paradigms.Java Design Patterns are divide into three categories - Creational ,Structural and behavioral design pattern.


Design Patters Categories


Some of the popular design patterns:






Java Interview Question Part - 2

Q1: What is Functional Interface ?
An interface which has Abstract Method can be called as Functional Interface Runnable,Comparator amd cloneable are same of the
example for Functional Intrafce,Lambda expressions can only be applied to abstract method of functional interface.

let see the some example bellow:

LambdaExample

Q2: Can we declaring our own Function Interfaces?
We can declare our own Fictional Interface by define Single Abstract Interface Method .We can used @FunctionalInterface  annotation ,to tell compile time errors, it is optional

Function Interfaces


Fuctional interface can has more then one abstract method but we can add more the default method,this Default method has
introduce in Java 8

Default Method

Q3: Why we needed the Default method?
Default methods in interfaces help us to introduce new functionality without breaking the contract of the implementing classes. Default method are those methods in interface which have body and used default keyword.
Let’s see in explanation:
Suppose we have an calculator interface that has addition, substation, percentage etc. as existing implementations.If we want to added new method in division.This can be done with default and static methods without breaking any functionality.


SCJP Certification

Sun Certified Java Professional(SCJP) exam is now Oracle Certified Professional Java Programmer (OCPJP) exam. Here are the are some dumps in pdf format for

 Java SE 6 Version.




  1.  Section 1
  2.  Section 2
  3.  Section 3
  4.  Section 4

 Java SE 7 Version
    
    1.OCPJP (1Z0-851)

ATG  eCommerce :

    1. ATG Web Commerce 10 (1Z0-510)
    

Java Interview Question Part - 1



Q1. What’s the purpose of Static methods and static variables?
Ans: When there is a requirement to share a method or a variable between multiple objects of a 
class instead of creating separate copies for each object, we use static keyword to make a
method or variable shared for all objects.

Q2. What is a singleton class ? Give a practical example of it's usage ?
Ans: A singleton class in java can have only one instance and hence all it's methods an variable belong to just one instance.Singleton class concept is useful for the situation when ther is need to limit the number of objects for a class.
The best example of the singleton is printer only one person can take print out at a time.

Q3.what is different between double and float variable in java?
Ans: In java float take 4 byte in memory while Double takes 8 bytes in memory. Float is single floating point decimal number while Double is double precision decimal number.

Q4.What is ternary operater ? 
 Ans: Ternary operater ,also called conditional operator is used to decide which value to assign to a variable base on the Boolean value evalution.

 String staus;
 int rank=3;
 staus =(ran == 1) ? "Pass " :"Fail";
 System.out.println(status);

Q5.Can we declare a class as Abstract without having any abstract method?
Ans: Yes we can create an abstract class by using abstract keywork before class name evenif it doesn't have any abstract method.However ,if a class has even one abstract method ,it must declered as abstact otherwise it will throw error.

Q6 What is Lambda Expression?
Lambda Expression is an anonymous function which accepts a set of inputs paramaters and return results,

Lambda Expression is block of code without any name  and it executed on demand.

Q7 What is Syntex of the Lambda Expression?
 () -> System.out.println("Hello Javaweb-world");
  -> is denoted as Lambda Arror Operator.It seperates paramaters list and body.

Q8.what is function interface ?
Ans: An interface with exactily one abstract method is called Functional interface.we can use lambda expressions to instantiate them and avoid using bulk anonymous class implementation. 

Q9. What is Garbage Collection?
Ans: Garbage Connection means to automatic memory management in java. Garbag collection is to keep as much of heap available free for the program as possible. JVM removes object on the heap which no longer have references from the heap.

Q10. Explain Garbage Collection with an example?
Ans: let see in the example:
    Public void getDateCal(){
       Calender cal=new GregorianCalendar(2017,10,30);
       System.out.println(cal);
    }
In above example Object of the class GergorianCalender is created on the heap by the first line of function with referance variable "cal".
End of the function execution,this referance variable cal is no longer valid.Hence JVM recognizes this

and remove the object from the heap.this is called Garbage Collection. 

Interview Questions

When you are interviewing for an Information technology job,in addition to standard interview question you will be asked during a job interview,you will be ask more focused and special technical question, here i am sharing some java and ATG eCommerce interview question and answer with SCJP and COPJP. 

ATG eCommerce Interview Question:
Java Interview Question:
Spring Interview Question:
JSP and Servlet Interview Question Part-1
JSON Interview Question

Sun Certified Java Professional(SCJP and OCPJP) :

Oracle has acquired Sun in early 2010 , the certificate has been officially renamed to Oracle Certified Professional Java SE Programmer or OCPJP.
The latest certification available is n Java 8 Version .OCAJP(lZO-808) In this exam covers bellow topic.

- Java Basic and OCPJP (lZO-809)
- Generics and Cllections
- I/O fundamentals,
- Concurrency
- JDBC and java 8

The exam topic can be found here:
You can serarch SCJP 6 and SCJP 7 Question set here.
    Click Here -->

ATG eCommerce :

     ATG web Commerce 10 exam topic can be found here

       ATG WebCommerce 10