Posts

Showing posts with the label example

Hibernate CRUD operations with auto increment in Oracle SQL with examples

Image
Previously I was explained Hibernate CRUD Operations without Auto Increment column. Here I am explaining how to do Hibernate CRUD operations with Primary key column as auto increment in Oracle SQL with examples. There will be slight difference in pseudo code compare to the previous example. But, mostly the same classes I have used to maintain the consistency. Before going to write the java logic, we have small work to do in the database to create the table and sequence. Please execute the below lines of SQL script in your SQL prompt or SQL developer. To create the table with primary key: create table USER_INFO(user_id NUMBER,user_name VARCHAR2(50),password VARCHAR2(50),CONSTRAINT user_id_pk PRIMARY KEY(user_id)); To alter the Primary Key Constraint: alter table USER_INFO ADD CONSTRAINT user_id_pk primary key(user_id); To create the sequence: create sequence user_sequence start with 1 increment by 1 nomaxvalue; That's it we are done with our work in database side. Now,...

How to sort list of objects in java with examples

We could achieve list of objects sorting in java by using sort() method which is available under Collections class as well as by using Comparable and Comparator  interfaces. Comparable and Comparator are two interfaces in java used to sort list of objects. These interfaces are available under java.util package along with Collections  class and other classes and interfaces. Comparable interface contains the method of       public int compareTo(Object obj) Comparator interface contains the method of       public int compare(Object obj1, Object obj2) The compare() and compareTo() methods will return negative integer(-1), or zero(0) or positive integer(1). When the first obj1 is less than obj2 method will return negative integer. When obj1 is equals to obj2 will return zero and when obj1 is grater than obj2 it will return positive integer. If it's objects are stored in any Collection classes like ArrayList, H...

Error while installing GWT plugin in eclipse

What type of errors we will get by installing GWT plugin in eclipse as well as what is new in GWT? will see in this page.  If you are new to GWT better first read GWT , then you will easily understand what I am explaining here. I was already explained in GWT page, how to install gwt plugin and create sample application and running the same application in development mode.  Previously I am using gwt-2.4 in my system with JDK-1.6 and eclipse-juno-4.2 in windows-xp. N ow, I got changed my system OS to Windows-8.1. I have installed JDK-1.6 as per my project requirement and I followed the same steps as previously I have installed GWT-plugin. The plugin was installed, but in eclipse GWT symbol is not displaying. I was tried with different eclipses, but there was no Luck. Finally I have uninstalled JDK 1.6 and again I installed JDK-1.7. After that I have tried again installing GWT-plugin in new eclipse. Now, I got the GWT symbol in my eclipse after that I realized that wa...

How to create spring application by using eclipse IDE

Image
To create spring application by using eclipse IDE, we have to follow below steps. There are majorly 5 steps we mentioned for how to create spring application by using eclipse IDE. That are, Create Java Project Add spring jar files Create the bean class Create XML file to provide values Create the Test class Create Java Project:         Follow these suggestions to create a new Java Project in Eclipse IDE. File --> New --> Java Project         Click 'Next' and then click 'Finish'. Add Spring libraries:         Once creating the project you can download the Spring core module libraries from the Internet and add it into your creating project. Spring core library files:         The below which I mentioned library files are related to Spring core module. In that which are mandatory and which are option...