Wednesday 29 August 2012

Java Training: - Differences between JNDI context, Initial context, session context and EJB context?


JNDI context
JNDI Context Provides a mechanism to lookup resources on the network

Initial context
Initial Context constructor provides the initial context.

Session context
Session Context has all the information a session bean would require from the container

Entity Context
Entity Context has all the information that an Entity bean would need from a container

EJB context
EJB Context contains the information that is common to both the session and entity bean

See the following video on EJB (Enterprise Java Beans): -



Click to get Java Training

Regards,

Get more Java Training from author’s blog

Wednesday 22 August 2012

Java Training: - Elaborate stateful and stateless session bean?

Stateful Session bean:-
  • Stateful session bean maintain the state of the conversation between the client and itself
  • When the client invokes a method on the bean the instance variables of the bean may contain a state but only for the duration of the invocation
  • implements the javax.ejb.SessionBean interface and is deployed with the declarative attribute "stateful"
Stateless session bean:-
  • A stateless session bean is an enterprise bean that provides a stateless service to the client.
  • Conceptually, the business methods on a stateless session bean are similar to procedural applications or static methods; there is no instance state, so all the data needed to execute the method is provided by the method arguments
  • implements the javax.ejb.SessionBean interface and is deployed with the declarative attribute "stateless
See the following video on Factory Pattern in Hibernate: -



Click to get Java Training

Regards,

Get more Java Training from author’s blog

Saturday 18 August 2012

Java Training: - Mention ORM and different levels of ORM quality?

ORM: -

ORM stands for Object/Relational mapping which is mainly used to remove the difference between object oriented and relation model

Different levels of ORM quality: -
  • Pure relational entire application, including the user interface, is designed around the relational model and SQL-based relational operations
  • Light object mapping The entities are represented as classes that are mapped manually to the relational tables
  • Medium object mapping The application is designed around an object model. The SQL code is generated at build time. And the associations between objects are supported by the persistence mechanism, and queries are specified using an object-oriented expression language
  • Full object mapping supports sophisticated object modeling: composition, inheritance, polymorphism and persistence
See the following video on Batch Processing in Hibernate: -



Click to get Java Training

Regards,

Get more Java Training from author’s blog

Monday 13 August 2012

Java Training: - How will you explain marshaling and unmarshalling?

Marshaling: -

Marshalling creates an XML document from a content tree.

To marshal a content tree,
  • Create a JAXBContext object
  • Create a Marshaller object (Marshaller marshaller = jaxbContext.createMarshaller();)
  • Set required properties using setProperty method of Marshaller marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));
  • Call the marshal method marshaller.marshal(collection, new FileOutputStream("jaxbOutput.xml"));
Unmarshalling: -

Unmarshalling an XML document means creating a tree of content objects that represents the content and organization of the document.

To unmarshal an XML document,
  • Create a JAXBContext object(JAXBContext jaxbContext = JAXBContext.newInstance("package name ");
  • Create an Unmarshaller object Unmarshaller unmarshaller = jc.createUnmarshaller();
  • Call the unmarshal method unmarshaller.unmarshal(new File( "xml name"));
  • Use the get methods in the schema-derived classes to access the XML data
See the following video on Introduction to Hibernate and it concepts in Java: -



Click to get Java Training

Regards,

Get more Java Training from author’s blog

Saturday 11 August 2012

Java Interview Questions: - How will you explain navigation rules and how to declare the same?

Navigation rules tells JSF implementation which page to send back to the browser after a form has been submitted
The above configuration says that navigation will happen to page2.jsp if the action eventAction happens inside page1.jsp

See the following video on Getting Started with Servlet in Java: -



Click to get Java Interview Questions

Regards,

Get more Java Interview Questions from author’s blog

Thursday 9 August 2012

Java Training: - Differences between DTDs and Schema?

Schema
DTD
Schema document is an XML document i.e., the structure of an XML document is specified by another XML documentDTDs follow SGML syntax
supports variety of data types similar to programming languageIn DTD everything is treated as text
creating relationship among elements is possibleThis is not possible in DTD without invalidating existing documents
Grouping of elements and attributes are possible to form a single logical unitGrouping of elements and attributes is not possible in DTD
it is possible to specify an upper limit for the number of occurrences of an elementIt is not possible to specify an upper limit of an element in DTDs

See the following video on overview on Servlets in Java: -



Click to get Java Training

Regards,

Get more Java Training from author’s blog

Friday 3 August 2012

Java Training: - Elaborate Bean lifecycle in Spring framework?

  • The spring container finds the beans definition from the XML file and instantiates the bean
  • Using the dependency injection, spring populates all of the properties as specified in the bean definition
  • If the bean implements the BeanNameAware interface, the factory calls setBeanName() passing the bean’s ID
  • If the bean implements the BeanFactoryAware interface, the factory calls setBeanFactory(), passing an instance of itself
  • If there are any BeanPostProcessors associated with the bean, their post ProcessBeforeInitialization() methods will be called
  • If an init-method is specified for the bean, it will be called
  • Finally, if there are any BeanPostProcessors associated with the bean, their postProcessAfterInitialization() methods will be called
See the following video on Inheritance between beans and Spring in Java: -



Click to get Java Training

Regards,

Get more Java Training from author’s blog