Posts

Showing posts from May, 2013

GWT for beginners - Introduction.

Image
Hi Everyone, from this post onwards I am planning to write about GWT (Google Web Toolkit) as it is currently used for many web development projects. GWT is an open source set of tools that allow web developers to create and maintain complex JavaScript front end applications in Java. Following are some of the specifications and features of GWT :- GWT is used to create RICH Internet Application (RIA). GWT provides option to write client side application in JAVA. GWT automatically generates javascript code suitable for each browser. GWT provides full debugging capability. Developers can debug the client side application just as an Java Application. GWT is licensed under apache license version 2.0. GWT provides easy integration with JUnit and Maven. GWT provides widget libraries. GWT has simple RPC mechanism. GWT has support for Internationalization and localization. HTML canvas support. GWT has support for using Google APIs. A number of libraries are available for GWT, by

Some more annotations in hibernate

Hi Everyone, in this blog post I am writing more about annotations used in hibernate. I hope everyone has seen my previous post about hibernate annotations - Basic Hibernate Annotations. 1) @Basic - It is the simplest type of mapping to a database column.If basic annotation is not specified for a field or property, the default values of basic annotation will apply. 2) @Transient - Specifies that the field or the property cannot be persisted. 3) @Temporal - Must be specified for persistent fields or properties of type and Date and Calendar. 4) @Lob - Used for persisting a large object to a database. 5) @Embeddable - The persistent properties or fields of the embedded object is mapped to the database table for the entity. 6) @Embedded - Specifies a field or persistent property of an entity whose value is an instance to an embeddable class. 7) @EmbeddedId - Applied to a field or persistent property of an entity class or mapped superclass to denote a composite primary

100 java interview questions

Hi everyone, in this blogpost, I am specifying 100 interview questions which are commonly asked during a java developer interview. It includes questions about core java, j2ee, struts, servlets, jsp, hibernate, spring and database. The questions are as follows: Difference between method overloading and method overriding. Different types of Annotations used. Explain about lists and sets. What are there differences ? Difference between super() keyword and this() keyword ? Difference between abstract class and interface. When are they preferred ? Static and dynamic binding in java? What is synchronization in java? What is synchronized method ? Difference between serializable and externalizable interface in java. What is abstraction ? What is polymorphism? What is runtime and compile time polymorphism ? What is generics in java ? What are abstract class and abstract method ? What is marker interface ? Examples of marker interface ? What is static method, static

Hibernate Annotations - @Table and @Column

Hi Everyone, in this blog post we will learn more about using the hibernate annotations @Entity and @Column. In this program, we are modifying the table and column name of the fields in the sample program of hibernate , which was discussed in my earlier post. The name of the table is changed using @Table annotation and name of the column is changed using @Column annotation. The updated code for AccountDetails.java is as follows: package  com.hibernate; import  java.util.Date; import  javax.persistence.Column; import  javax.persistence.Entity; import  javax.persistence.Id; import  javax.persistence.Table; @Entity @Table  (name =  "ACCOUNT_TABLE" ) public   class  AccountDetails {      @Id      @Column (name =  "ACCOUNT_ID" )      public   int  accountId;           @Column  (name =  "ACCOUNT_NAME" )      public  String accountName;           @Column  (name =  "ACCOUNT_DATE" )      public  Date accountDate;       

Important annotations used in Hibernate

Hi everyone, in this blogpost, I am discussing about some of the important annotations used in Hibernate. Following are some of the important annotations: - @Entity - @Entity specifies that the class is marked as an entity bean . @Table -  @Table is used to specify the table for persisting data. The optional attributes of the table annotation is ' name ' and ' schema ' which specifies both the name and schema of the table respectively. Other attributes are ' unique constraints ' which specifies the unique constraints that are to be placed on the table and ' catalog ' which specifies the catalog of the table. @Id - @Id specifies the identifier property of the entity bean. It is like a primary key of the table. The mapped column for primary key of the entity is assumed to be primary key of the primary table. If no column annotation is specified, the primary key column is assumed to be the name of primary key property or field. @Column - @C

Sample program using hibernate

Hi Everyone, in this blog post, I will write a sample program using hibernate. Please check my earlier post about hibernate, which is mainly the introduction of hibernate - Introduction to hibernate.  In this program, we are trying to add some data to database using hibernate. Here, we have mainly 2 classes. One for creating the bean class and the second one for creating the SessionFactory and saving the transaction details. The bean class ( AccountDetails.java ) which describes the table and rows is as follows: package  com.hibernate; import  java.util.Date; import  javax.persistence.Entity; import  javax.persistence.Id; @Entity (name =  "ACCOUNT" ) public   class  AccountDetails {      @Id      public   int  accountId;      public  String accountName;      public  Date accountDate;           public   int  getAccountId() {          return  accountId;     }      public   void  setAccountId( int  accountId) {          this .accountId = accoun