Showing posts with the label hibernate

DATATYPES in sql || Sql Tutorial -5

DATATYPES IN SQL  The data type represents the type of data to be entered into a column and Db engine can assign memory for thevalue entered into the column. There are 5 types of DataType in sql. String DataTypes Numeric DataTypes Date Datatypes Binary DataTypes LOB--Large Objects String Data Types These data types support sequence of character, digits and any symbol from keyboard. CHAR(size) It is used to store fixed length character strings. By default the size is 1 character, and max size is 2000 chars orbytes. Ex: student_id, email, address and so on VARCHAR2(size) It is used to store variable length character strings. No default size. we should specify size and max size is 4000 chars /bytes. Ex: emp names, addresses, descriptions, city names. LONG It is used to store variable length char data(similar to varchar2 data type) but max size is 2 GB NOTE: Only one long type column is allowed per a table. 1) NUMBER(Precision, [Scale])    It is used to store numb

Naming convention in SQL Sql Tutorial -4

Naming Convention in SQL Rules to follow before specifying names(Object names, Column Names and Variable Names). Each name should begins alphabet Valid character set is a-z,A-Z,0-9,@,$,# and _ (underscore) Ex:  Emp123   Emp_o11 Names are not case sensitive Already existed names are not allowed Pre defined keywords (ReservedWords) are not allowed as names. Blankspace within a name is not allowed Max length of any name is 32 chars

Features of Sql * Plus

Features of Sql * Plus At a time only one query is allowed to execute Sql queries are not case sensitive Each query is terminated with ; ( semi colon ) SQL commands are ANSI standard ( American National standard institute )

What is sql in Deep(Structured query language). Sql Tutorial -1

What is sql in Deep(Structured query language) Oracle was the first company to release a product that used the English-based Structured Query Language, or SQL. This language allows end users to extract information themselves, without using a systems group for every little report. Oracle’s query language has structure, just as English or any other language has structure. It has rules of grammar and syntax, but they are basically the normal rules of careful English speech and can be readily understood. What is SQL QUERIES It is known as data base language. It is used to communicate with any database. We can use this language constructs to write SQL QUERIES. What is SQL* PLUS SQL * PLUS is a default client tool and acts as an interface between client and database. What is SQL It is a collection of pre defined commands and constructs with syntactical rules

Array of string arguments in Java || string args[]

public static void main( String []args ). This string args is used to taking input from console,when we access the file and give some input value. suppose our filename is And the className, which has Main method is ABC. To compile this we Run command- javac After the compilation this will generate class code that is- ABC.class When we run this using- java ABC “ if here we pass some value this value will go to the args ”. so thats why we use it.

HTTP status 404 in servlet programming in Java ( Apache Tomcat 7)? || http 404

Error 404 is generate when, Database connection is failed. Incorrect query parameters. Incorrect dB name. Mismatch swapping between webpages.

Type error “Java.util.Scanner.nosuchelementexception” || Exception || nosuchelementexception

This exception extends the  RuntimeException  class and thus, belongs to those exceptions that can be thrown during the operation of the  Java Virtual Machine (JVM) . It is an unchecked exception and thus, it does not need to be declared in a method’s or a constructor’s throws clause. The NoSuchElementException in Java The  NoSuchElementException   can be thrown by the following methods : Enumeration::nextElement() NamingEnumeration::next() StringTokenizer::nextElement() Iterator::next() All the aforementioned methods try to return the next element of an  enumeration  and throw that exception, in order to indicate that no more elements exist. example- import   java . util . HashSet ; import   java . util . Hashtable ; import   java . util . Set ; import   java . util . StringTokenizer ; public   class   NoSuchElementExceptionExample { public   static   void   main ( String [] args ) { Set sampleSet = new   HashSet (); Hashtable sampleTable =

Is-a and Has-a RelationShip

In java or other object oriented programming language is-a and has-a are two type of relationship under the concepts of inheritance. suppose we have three class Car. subaru. engine. subaru is a car — its a is-a  relationship  between  class  subaru and  class  car. car has a engine — its a has-a  relationship  between  class  car and  class  engine.

Java class Name main

We can put the class name main their is no  compilation error or run time error . class main { public static void main(String []args) { // do your code } } now suppose our filename is and now we are compiling it with command prompt- compiling- javac Run- java main

How can I create thread array?

int [] testscore = new int[4];  //create an array of size 4. similarly we create thread array, Thread threads = new Thread[5]; // no thread objects created!   one   Thread array created Remember that, we are not creating a thread instance ,but rather a single Thread array object.

What is Singleton class and how to use it in Java?

What is Singleton class and how to use it in Java? Singleton pattern helps us to keep only one Instance of class at any Time. The purpose of singleton is to Control object creation by keeping private Constructor. Example- public class MySingleTon { private static MySingleTon myObj; /** * Create private constructor */ private MySingleTon(){ } /** * Create a static method to get instance. */ public static MySingleTon getInstance(){ if(myObj == null){ myObj = new MySingleTon(); } return myObj; } public void getSomeThing(){ // do something here System.out.println("I am here...."); } public static void main(String a[]){ MySingleTon st = MySingleTon.getInstance(); st.getSomeThing(); } } Reference on Quora