Java interview questions for 5 years experience


SUBMITTED BY: Guest

DATE: Jan. 26, 2019, 8:13 a.m.

FORMAT: Text only

SIZE: 12.2 kB

HITS: 253

  1. Java interview questions for 5 years experience
  2. => http://tiosuregcong.nnmcloud.ru/d?s=YToyOntzOjc6InJlZmVyZXIiO3M6MjE6Imh0dHA6Ly9iaXRiaW4uaXQyX2RsLyI7czozOiJrZXkiO3M6NDc6IkphdmEgaW50ZXJ2aWV3IHF1ZXN0aW9ucyBmb3IgNSB5ZWFycyBleHBlcmllbmNlIjt9
  3. It is a part of Java Collections Framework since jdk 1. Array List can only use Iterator for traversing an Array List. Throws ObjectNotFoundException if object is not found.
  4. Can a main method be overloaded? In hibernate you can perevent slate object updatation using version checking. WebDriver directly communicates with the web browser and uses its native compatibility to automate.
  5. This is where an object or class can come into characteristics and features from one or more parent object or parent class. Therefore, if one thread changes the reference variable points to another array, which will provide a volatile guarantee. The differences between get and load methods are given below. This kind of questions is also asked quite frequently to experienced and senior Java developers with 5 to 7 years of experience. One line code : Collections. If you want to post code then wrap them inside tags. Thanks Aggregation is an association in which one class belongs to a collection. Array is static in size while ArrayList is dynamic in size. You might find some of the questions very easy but believe me most developers failed to answer these questions. Iterators returned by the iterator method are fail-fast , hence , will throw ConcurrentModificationException.
  6. Java Exceptions Interview Questions (+ Answers) - It is a question of whether or not an external object or program , actually needs direct access to the information. BeforeTest AfterTest BeforeClass AfterClass BeforeMethod AfterMethod BeforeSuite AfterSuite BeforeGroups AfterGroups Test 106.
  7. It is the programmed and translucent perseverance of objects in a Java java interview questions for 5 years experience in to the tables of a relational database using the metadata that describes the mapping between the objects and the database. It works by transforming the data from one representation to another. An object can not be detached in entity beans and in hibernate detached objects are supported. Session instances are the primary interface for the persistence service. If both files are present in the classpath then hibernate. It is the best practice to store each object in an individual mapping file i. Ans: Mapping of classes can be made into a proxy instead of a table. A proxy is returned when actually a load is called on a session. The proxy contains actual method to load the data. The proxy is created by default by Hibernate, for mapping a class to a file. What is lazy fetching in hibernate. Ans: Lazy fetching is associated with child objects loading for its parents. Hibernate does not load the whole child objects by default. Explain the difference between transient java interview questions for 5 years experience detached objects in hibernate. Ans: T ransient objects do not have association with the databases and session objects. They are simple objects and not persisted to the database. Once the last reference is lost, that means the object itself is lost. And of coursegarbage collected. The commits and rollbacks will have no java interview questions for 5 years experience on these objects. They can become into persistent objects through the save method calls of Session object. The detached object have corresponding entries in the database. These are persistent and not connected to the Session object. These objects have the synchronized data with the database when the session was closed. Since then, the change may be done in the database which makes this object stale. The detached object can be reattached after certain time to another object in order to become persistent again. What are the core interfaces of Hibernate framework. The instances are light weighted and can be created and destroyed without expensive process. For the whole application, there will be generally one SessionFactory and can be shared by all the application threads. The location specification is specified by specific mapping documents, is done by the instance of this interface. What are the different types of caches in Hibernate. Ans: Hibernate uses two different caches for objects: first-level cache and second-level cache. First-level cache is associated with the Session object, while second-level cache is associated with the SessionFactory object. By default, Hibernate uses first-level cache on a per-transaction basis. How does the hibernate second-level cache work. Ans: Hibernate always tries to first retrieve objects from the session and if this fails it tries to retrieve them from the second-level cache. If this fails again, the objects are directly loaded from the database. Hibernate's static initialize method, which populates a proxy object, will attempt to hit the second-level cache before going to the database. The Hibernate class provides static methods for manipulation of proxies. What is a query cache in Hibernate. Ans: The query cache is responsible for caching the results and to be more precise the keys of the objects returned by queries. Let us have a look how Hibernate uses the query cache to retrieve objects. In order to make use of the query cache we have to modify the person loading example as follows. What is callback interfaces in hibernate. Ans: Callback interfaces of hibernate are useful in receiving event notifications from objects. For example, when an object is loaded or deleted, an event is generated and notification is sent using callback interfaces. What is the difference between and merge and update. Ans: Use update if you are sure that the session does not contain an already persistent instance with the same identifier, and merge if you want to merge your modifications at any time without consideration of the state of the session. What is the difference between and load and get. What are the different caching strategies. Ans: Read-only: This strategy is useful for data that is read frequently but never updated. This is by far the simplest and best-performing cache strategy. They carry more overhead than read-only caches. Therefore, it may be most appropriate for data that is read often but only occasionally modified. What are the different fetching strategy in Hibernate. What is version checking in Hibernate. Ans: version checking used in hibernate when more then one thread trying to access same data. Then User A click the Update and update done. Chnage made by user B is gone. In hibernate you can perevent slate object updatation using version checking. Check the version of the row when you are upding the row. On the time of updation just fetch the version number and match with your version number on the time of fetching. Difference between getCurrentSession and openSession in Hibernate. A Session is opened when getCurrentSession is called for the first time and closed when the transaction ends. It does not flush and close automatically. Ans: It is possible to re-load an object and all its collections at any time, using the refresh method. This is useful when database triggers are used to initialize some of the properties of the object. What is the difference between the session. Ans: Both of these methods and saveOrUpdate method are intended for reattaching a detached object. It is the best practice to use either session. Ans: The SessionFactory is the concept that is a single data store and thread safe. Because of this feature, many threads can access this concurrently and the sessions are requested, and also the cache that is immutable of compiled mappings for a specific database. A SessionFactory will be built only at the time of its startup. In order to access it in the application code, it should be wrapped in singleton. This wrapping makes the easy accessibility to it in an application code. Ans: This represents hibernate session which perform the manipulation java interview questions for 5 years experience the database entities. Some of the activities performed by session interface are as follows they are managing the persistence state, fetching persisted ones and management of the transaction demarcation. Explain about the dirty checking feature of Hibernate. Ans: Dirty checking feature of the Hibernate allows users or developers to avoid time consuming data base write actions. This feature makes necessary updations and changes to the fields which require a change, remaining fields are left unchanged or untouched. Explain the steps involved in creating database applications with Java using Hibernate. Ans: Creating Database applications with Java is made simpler with Hibernate. Ans: Hibernate can be configured with two types of files out of which hibernate. These files are searched on class path. Explain about mapping description file. Ans: Mapping description file is the second file which Hibernate uses to configure its functions. The usage of mapping description file rests entirely upon the business entity. Ans: Transactions denote a work file which can save changes made or revert back the changes. A transaction can be started by session. When this session starts several transactions may occur. Explain about mapping files in Hibernate. Ans: Mapping files forms the core of any database mapping tools. These files contain field to field mapping, usually this mapping occurs between classes and attributes. After mapping files they can be persist to the database. Tags can be used to indicate the presence of a primary key. What is the effect when a transient mapped object is passed onto a Sessions save. Garbage collection and termination of the Java virtual machine stays as long as it is deleted explicitly. It may head back to its transient state. Ans: Application level data integrity constants are important if you are making changes to offline information which is again backed by database. Higher level locking or versioning protocol is required to support them. Version field usage comes at this stage but the design and implementation process is left to the developer. Explain State some advantages of hibernate. It supports inheritance relationships and is generally a fast tool. Portability is necessary the greater benefit from hibernate. Ans: This function translates a Java class name into file name. This translated file name is then loaded as an input stream from the Java class loader. This addclass function is important if you want efficient usage of classes in your code. Explain about addjar and addDirectory methods. Ans: These methods are the most convenient to use in hibernate. These methods allow you to load all your Hibernate documents at a time. These methods simplify code configuration, refactoring, layout, etc. These functions help you to add your hibernate mapping to Hibernate initialization files. Explain about the id field. Ans: This id field corresponds to the surrogate key which is generated by the database. These fields are handled by the id field. Name attribute is used to specify the names of the field and it should correspond to the method name of getid. This also should correspond to long type and the values should be stored I the database in the long column. What are the most common methods of Hibernate configuration. Define cascade and inverse option in one-many mapping. Ans: cascade — enable operations to cascade to child entities. How can a whole class be mapped as immutable. This specifies that instances of the class are not mutable. Immutable classes, may not be updated or deleted by the application. How to Execute Stored procedure in Hibernate. What is a meant by light object mapping. Ans: The entities are represented as classes that are mapped manually to the relational tables. The code is hidden from the business logic using specific design patterns. This approach is successful for applications with a less number of java interview questions for 5 years experience, or applications with common, metadata-driven data models.

comments powered by Disqus