Programming Articles

Page 2399 of 2547

Difference between sequence and identity in Hibernate

Himanshu shriv
Himanshu shriv
Updated on 21-Jan-2020 11K+ Views

Hibernate or JPA support 4 different types of primary key generator. These generators are used to generate primary key while inserting rows in the database. Below are the primary key generator −GenerationType.AUTOGenerationType. IDENTITYGenerationType.SEQUENCE GenerationType.TABLEGenerationType. IDENTITY − In identity , database is responsible to auto generate the primary key. Insert a row without specifying a value for the ID and after inserting the row, ask the database for the last generated ID. Oracle 11g does not support identity key generator. This feature is supported in Oracle 12c. GenerationType. SEQUENCE − In sequence, we first ask database for ...

Read More

Difference between Collection.stream().forEach() and Collection.forEach() in Java

Himanshu shriv
Himanshu shriv
Updated on 21-Jan-2020 1K+ Views

Collection.stream().forEach() and Collection.forEach() both are used to iterate over collection. Collection.forEach() uses the collection’s iterator. Most of the collections doesn’t allow the structurally modification while iterating over them. If any element add or remove while iteration they will immediately throw concurrent modification exception. If Collection.forEach() is iterating over the synchronized collection then they will lock the segment of the collection and hold it across all the calls. Collection.stream().forEach() is also used for iterating the collection but it first convert the collection to the stream and then iterate over the stream of the collection therefore the processing order is undefined. ...

Read More

Difference between save() and persist() in Hibernate

Himanshu shriv
Himanshu shriv
Updated on 21-Jan-2020 23K+ Views

Save() and persist() both methods are used for saving object in the database. As per docs −Save() − Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.) This operation cascades to associated instances if the association is mapped with cascade="save-update".As per docs −persist() − Make a transient instance persistent. This operation cascades to associated instances if the association is mapped with cascade="persist". The semantics of this method are defined by JSR-220. Sr. No.Keysave()persist()1Basic It stores object in databaseIt also stores object ...

Read More

Difference Between get() and load() in Hibernate

Himanshu shriv
Himanshu shriv
Updated on 21-Jan-2020 27K+ Views

In hibernate, get() and load() are two methods which is used to fetch data for the given identifier. They both belong to Hibernate session class. Get() method return null, If no row is available in the session cache or the database for the given identifier whereas load() method throws object not found exception. Sr. No.KeyGet()Load()1Basic It is used to fetch data from the database for the given identifier It is also used to fetch data from the database for the given identifier 2Null Object It object not found for the given identifier then it will return null ...

Read More

Difference Between First level cache and Second level cache in Hibernate

Himanshu shriv
Himanshu shriv
Updated on 21-Jan-2020 11K+ Views

Hibernate support two type of cache one is first level cache and other is second level cache. First level cache is a session level cache and it is always associated with session level object. This type of cache is used for minimizing Db interaction by caching the state of the object. That is instead of updating after every modification done in the transaction, it updates the transaction only at the end of the transaction.Second level cache is session factory level cache and it is available across all sessions.While running the transactions, in between it loads the objects at the Session Factory level, ...

Read More

Elements present in first array and not in second using STL in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 20-Jan-2020 252 Views

We have two arrays, the task is to compare the two arrays and find the numbers present in first array but not in the second array, using Standard Template Library (STL) in C++.ExampleInput: array1[ ] = {1, 2, 3, 4, 5, 7} array2[ ] = {2, 3, 4, 5, 6, 8} Output: 1, 7 Input: array1[ ] = {1, 20, 33, 45, 67} array2[ ] = {1, 12, 13, 114, 15, 13} Output: 20, 33, 45, 67Approach used in the below program is as follows −In this program we want to find the elements which are present in the first ...

Read More

XDM – The Download Manager for Linux that ramps up Your Speed to 500%

karthikeya Boyini
karthikeya Boyini
Updated on 17-Jan-2020 408 Views

Xtreme download supervisor (xdman) is an effective download supervisor for Linux, which is developed in Java programing language. It can increase download speeds of upto 500% and is an alternative for the windows IDM (Internet Download Manager). It is compatible with many popular internet browsers such as Firefox, Chrome, Opera.Before installing Xtreme Download supervisor, Check if Java is installed or not available by typing java -version in command line.$ java -versionThe sample output should be like this –openjdk version "1.8.0_91" OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14) OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)Installing Xtreme Download Manager in LinuxTo put the ...

Read More

Selenium WebDriver- Revisiting Important Features

Sharon Christine
Sharon Christine
Updated on 17-Jan-2020 309 Views

It’s been more than a decade since Selenium automation tool is here to automate our testing needs. As a free to use tool with dedicated community, it has lot of features to make our automation testing more reliable and comfortable. Seeing the growing popularity of Selenium webdriver, let’s revisit some of the important features of it, which proves why Selenium webdriver still stand out in the crowd.Key Features – Selenium WebDriverCompatibility with Many Web BrowsersSelenium WebDriver supports wide range of web browsers available in the market such as Firefox, Chrome, Internet Explorer, Opera, Safari and many more. Unless the other ...

Read More

Print all sequences starting with n and consecutive difference limited to k in C++

sudhir sharma
sudhir sharma
Updated on 17-Jan-2020 182 Views

In this problem, we are given three variables n, s, and k and we have to print all the possible sequences that start with the number n and length s having the absolute difference between consecutive elements less than k. Let's take an example to understand the topic better − Input: n = 3, s = 3 , k = 2 Output: 3 3 3 3 3 4 3 3 2 3 4 4 3 4 5 3 4 3 3 2 2 3 2 3 3 2 1 In this problem, we need to obtain the ...

Read More

Print all subsequences of a string using ArrayList in C++

sudhir sharma
sudhir sharma
Updated on 17-Jan-2020 192 Views

In this problem, we are given a string and we have to print all subsequences of the string. The substring is formed by deleting elements. Also, the order of string should not be altered.Let’s take an example to understand the problem better −Input: string = “xyz” Output: x y xy z xz yz xyzTo solve this problem, we will find all substring starting from freezing the first character of the string and find subsequence accordingly, then going for the next character in string and subsequence.Examplepublic class Main {    public static void printSubString(String sub, String subSeq){       if ...

Read More
Showing 23981–23990 of 25,466 articles
Advertisements