[solved] org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: Meaning of this exception:If we are trying to save the same identifier (primary key) with different session we will get this error. How I solved ?I have used Transaction and session previosly, then I replaced those things with getHibernateTemplate, getHibernateTemplate().saveOrUpdate(myBean); Then issue got resolved. In

154 total views, no views today

» Read more

Debugging based on Exception in Breakpoints Eclipse

we know how to debug in eclipse using breakpoints, Now we are going to learn how to debug based on exceptions in eclipse, Window -> Show view -> Breakpoints It will look like this, click “Add Java Exception Breakpoint” icon as mentioned in the above screenshot, Sample Java Program: package in.javadomain; public class BreakPointException { public static void main(String[] args)

125 total views, no views today

» Read more

[solved] Xhtml Changes without Restarting websphere server issue

In websphere 6.1 or 7.0 or 8.0, xhtml or jsp changes also will expect the server to restart by default. This issue can be resolved by adding this below codes to your web.xml file, <context-param> <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name> <param-value>0</param-value> </context-param> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> <param-value>Development</param-value> </context-param> Note: 1. If you set the param-value to -1 then it disables refresh checking. 2. Project_stage can be

146 total views, no views today

» Read more

Selenium click Event Sample Program in Java

Selenium click Event: In the post, we are going to load www.javadomain.in site using selenium in java and JSP and Servlet page will be clicked after the page load. Selenium Java Program to Click: import java.io.File; import org.openqa.selenium.ie.InternetExplorerDriver; public class SeleniumClickEvent { public static void main(String[] args) { File file = new File("D:/IEDriverServer.exe"); System.setProperty("webdriver.ie.driver", file.getAbsolutePath()); InternetExplorerDriver driver = new InternetExplorerDriver();

127 total views, no views today

» Read more

Selenium hello world in IE Example

Download the Webdriver: Webdriver Download Add all the jars from the above downloaded to the build path. Selenium Java Program to open Google: import java.io.File; import org.openqa.selenium.ie.InternetExplorerDriver; public class SeleniumHelloWorld { public static void main(String[] args) { File file = new File("D:/IEDriverServer.exe"); System.setProperty("webdriver.ie.driver", file.getAbsolutePath()); InternetExplorerDriver driver = new InternetExplorerDriver(); driver.get("http://www.google.co.in"); } } Output: Note: Download the IE Driver: 32-bit IE

211 total views, no views today

» Read more

Importing Js file in Html Example

Javadomain.js: [Js file] function alertMe(){ alert("Hello Javadomain.in"); } Import.html <html> <head> <script type="text/javascript" src="Javadomain.js" > </script> </head> <body onload="alertMe();"> </body> </html> What we did: 1. We have written a javascript file named javadomain.js which contains a method called alertMe, which prints Hello Javadomain.in 2. Now this method is imported in Import.html file using src attribute of script tag. you can

134 total views, 3 views today

» Read more

Sorting Map keys in Java Example

Sorting Map keys in Java Example: Sorting map key can be done simply by changing the treemap to treemap. Which will print the keys in ascending order. In the below program we have tried printing the map key with hashmap, since hashmap   HashMap: HashMap is a type of collection in java to store key/value pairs. We cannot predict the

120 total views, no views today

» Read more

Split in Java Example

Split Function:   You can split a string using regex(regular expression) or by comma or anything you want. Here example given to split a string by comma. String Split by Comma Java Program: package in.javadomain; import java.util.ArrayList; public class CommaSplit { public static void main(String[] args) { String links = "http://www.google.com,http://www.facebook.com,http://www.youtube.com,http://www.ebay.com"; ArrayList linkList = new ArrayList(); // Splitting by comma

94 total views, no views today

» Read more
1 2