Wednesday, June 19, 2013

Sushil Kumar Shinde confirms terror threat on Amarnath Yatra


 
New Delhi: Home minister Sushil Kumar Shinde has confirmed reports that the iconic Amarnath Yatra is under threat from terrorists and the security agencies are working hard to ensure safety of pilgrims.

“There is terror threat to Amarnath yatra and all measures are being taken to ensure security of pilgrims,” he told PTI.

The Amarnath Yatra beginning on June 28 is under threat from Pakistan terrorists as Intelligence sources and the Army have observed the increased militant attempts to penetrate the counter insurgency grid in South Kashmir's Anantnag area.

Reports suggest that many of the terrorists who have crossed borders last month have merged with the local population and are the biggest threat to the pilgrims.

The Army has received inputs that terrorists might try to disrupt the Amarnath Yatra scheduled to commence from June 28, General Officer Commanding-in-Chief, Northern Command, Lt General K T Parnaik said on Monday.

"Intelligence inputs which we are receiving suggest that they (terrorists) have intentions to disrupt the Yatra," Parnaik told reporters on the occasion of the Raising Day of the Northern Command.

He, however, said it was difficult to gauge where from these threats were emanating and how the terrorists might try to attack the pilgrimage.

"These warnings are coming, but who these persons are and where from they are coming, how will they strike one doesn't know," he said.

The General said the forces need to maintain a high degree of alert and foil any such attempt made by the anti-national elements.
 
 

Deaths in Gandhi family: Tragic moments of Rahul’s life

Deaths in Gandhi family: Tragic moments of Rahul’s life
New Delhi: Celebrating his 43rd birthday today, Congress Vice-President Rahul Gandhi can be called the ‘most eligible bachelor’ of India. The journey of Rahul Gandhi has gone through several ups and downs. While there are some unpleasant truths about the Gandhi scion, the family has witnessed some tragedies in the family after the marriage of Sonia Gandhi and former Prime Minister Rajiv Gandhi.

Dailybhaskar.com talks about the deaths in Gandhi family which shattered Rahul Gandhi. Click the slides to read more…
 
Deaths in Gandhi family: Tragic moments of Rahul’s life
Rahul’s uncle Sanjay Gandhi

Rahul Gandhi was 10 years old when his uncle and the most controversial son of Gandhi family, Sanjay Gandhi, died. Indian politics blames Sanjay Gandhi for the emergency declared in the country during 1975-77. Besides this, the decision of forceful implementation of family planning and demolishing the slums at Jama Masjid, is still criticised. He died on June 23, 1980 in a plane crash. After the incident, Rahul’s aunt Maneka Gandhi left home along with his son Varun Gandhi.
 

Deaths in Gandhi family: Tragic moments of Rahul’s life
Rahul’s grandmother Indira Gandhi

Indira Gandhi is the first and the only female prime minister of India so far. She was responsible for wiping out the terrorist group led by Jarnail Singh Bhindranwale from the Golden Temple in Amritsar after the victory over Pakistan in 1971 war. She was assassinated by her Sikh bodyguards on Octobet 31, 1984 as she was held responsible for the 1984 anti Sikh riots in which numerous Sikhs were slaughtered.
  
Deaths in Gandhi family: Tragic moments of Rahul’s life
Rahul’s father Rajiv Gandhi

Indira Gandhi’s death shook the nation. The entire country looked upon Rajiv Gandhi in the disastrous time and the latter held the responsibility of the nation. He was a calm and composed leader. He holds the record of becoming the prime minister with maximum majority. He is considered to be the father of Telecom revolution. He was assassinated on May 21, 1991 in a suicide attack in Perambur, Chennai. LTTE of Sri Lanka had claimed responsibility for the attack.
  


Harbhajan Singh turns counsellor for flood-stranded pilgrims and tourists in Uttarakhand


Dehradun: Cricketer Harbhajan Singh, who has been stranded at Joshimath in Chamoli district of Uttarakhand, on Tuesday took the role of a counsellor alongside ITBP personnel as he met a number of pilgrims hit by incessant rains and floods.
 
The cricketer is staying at the Indo-Tibetan Border Police (ITBP) camp at Joshimath since the last three days after he too could not reach Hemkund Sahib gurudwara due to inclement weather.
 
The off-spinner accompanied ITBP officials to the forces' barracks and campuses on Tuesday where stranded pilgrims are being provided food and medicines and talked to them.
 
"He counselled them (pilgrims and tourists) that all would be well soon and that force personnel and others are trying to bring as much succour as they can. He gave them food and water and spent with them," a senior ITBP official said.
 
The ITBP has deployed close to 600 personnel for relief and rescue operations in the state and has opened up its office and residential buildings for the people to stay.
 
"Our jawans have even emptied their barracks to accommodate the people who are stuck. Every effort is being made to provide food, water and medicines through two private choppers that have been pressed in by the force," the official said.
 
The force has spread its men to rain-hit areas in Kedarnath, Gaurikund, Govindghat, Pandukeswar, Karnaprayag, Badrinath and Uttarkashi.

Dangerous waters: 4 Indians, Polish kidnapped in Nigeria pirate attack


 
New Delhi: Four Indian and Polish crew members were kidnapped last week say security forces when speedboat riding pirates attacked an oil supply vessel off the Nigerian coast. 
In what can be regarded as waters that are becoming increasingly dangerous, the gunmen launched their assault on the Singapore-flagged tugboat MDPL Continental One around 30 nautical miles from land on June 13.
 
The vessel was ransacked after which  four crew were taken hostage .
 
The boat's management company CS Offshore declined to go into further details "in order not to endanger those involved". Pirate attacks off West Africa's mineral-rich Gulf of Guinea have almost doubled from last year and threaten to jeopardise the shipping of commodities from the region. They have already jacked up insurance costs.
 
The attacks are mostly carried out by armed Nigerian gangs also blamed for kidnappings and oil theft on land.
 

Cabinet reshuffle: 'Loyalty' given precedence over 'ability', Congress sacrifices youthful image for social balance?


New Delhi: The Congress has always sought to give an impression that it has its finger firmly on the pulse of the youth by pushing the Gandhi scion Rahul as one of the important leaders of its poll campaign.  Most of the ministers who took oath on Sunday as the new members of the Union Council of Ministers are way past their retirement age.
 
While the average age of the Congress working committee being 52 years, it begs the question if the party is not one of old men, with only Rahul Gandhi at the top giving it a false youthful image. It is indeed significant that among the ministers who took oath on Sunday, JD Seelam is the youngest at 60, while Sisram Ola, a Jat leader from Rajasthan, being a ripe 86 years of age.
 
Ironically, the UPA government, which did not approve the proposal to increase the retirement age of its employees from 60 to 62 years, inducted in its Cabinet such an old minister who even struggled to read the oath. Interestingly, he has been given Labour and Employment Ministry.
 
He is the same minister who was dethroned four years ago for lack of performance. Now, he has been brought back when anyone can imagine what the quality of his performance could be.
 
Though the Congress claims that it has tried to strike a balance between the young and the old, the situation on the ground reveals that the party is anxious about the forthcoming elections in several states, apart from the general elections due next year. 
 
Rajasthan is going for elections later this year. And there is cause for worry for the Congress in the state. With his miserable performance, Chief Minister Ashok Gehlot has only made things difficult for the party. There are talks that the Congress may be decimated once again in Rajasthan. The party high command needed to contain the damage at least by the fraction. They have tried to appease the Jat vote bank by inducting a Jat minister into the cabinet, besides bringing in another Gandhi family loyalist from the state, Girija Vyas. Sadly, this may not really be sufficient to diffuse the anger of the common man in Rajasthan, including the Jats. The tactic may not help in averting a rout.
 
Several other appointments also have a political foresight, if not shrewd election gimmick. Karnataka has been given special prominence with the induction of one new cabinet minister in the person of Oscar Fernandes, besides giving the plum portfolio of the Railways to Mallikarjuna Kharge. The reward to the state is due to the splendid performance of the state Congress in the recent Assembly elections. The high command is expecting a bounty once again from the state in the coming general elections.
 
Despite already having a sizeable representation, another minister from Andhra Pradesh was inducted. Now, there are a total of 11 ministers in UPA-II from Andhra. The party knows that it has a battle to fight against Y S Jaganmohan Reddy and his YSR Congress in the Assembly elections next year when the state goes for polls.

Villagers kill three men as they panicked on rumours of naked lunatics set out to rape women


Tezpur: In a shocking incident, villagers of Balishiha in Sonitpur district lynched three persons on Wednesday over rumours that naked men were at large to rape women. Lethaly armed villagers were guarding the village when they stopped three men in a car. The three men reportedly attacked the villagers. Suspecting these men to be the rumoured rapists, the villagers retaliated killing all three at the spot.

Sonitpur district SP Arabinda Kalita said the three victims -- Ashutosh Das and Md Jalil of Dhekiajuli, and Prabin Bhawal of Rangapara -- were wanted criminals involved in car lifting and stealing of fuel from cars.

Rumour of the naked men has sparked fear in Tezpur area with people guarding their villages with lethal weapons to protect their women.

The authorities have appealed to the people not to carry lethal weapons during their night patrol. They have also appealed that any such incident should be reported to police. 
 
 

NDMA directs MeT department to chalk-out action plan for spot on weather forecast at pilgrimages


Delhi: The National Disaster Management Authority on Wednesday directed the India Meteorological Department to make weather monitoring and forecasting for the Char Dham pilgrimage more accurate so that disasters like Uttarakhand’s Kedarnath don’t occur in future, or preventive measures be taken to save pilgrims from the natural calamity.

According to reports, the NDMA has directed the MeT to draw up a time bound plan to increase the efficiency of the weather forecast. The department has been directed to take a cue from weather management in the Amarnath Yatra in IMD issues short-term forecasts every day in the morning for various locations on the two routes to the cave.

At least 102 have been confirmed dead in Uttarakhand while the total death toll has reached to 131. Over 72,000 are still stranded across Uttarakhand with the holy town of Kedarnath being the worst hit. Apart from 102 people dead in Uttarakhand, 29 deaths were reported from neighbouring Himachal Pradesh.

Landslides left scores of tourists and pilgrims stranded in the hill states of Uttarakhand and Himachal Pradesh while thousands have been displaced in Uttar Pradesh where several rivers are in spate.
 
The state has received 313 mm rainfall so far which is a phenomenal 375 per cent above the normal benchmark of 65.9 mm rainfall that state receives during a normal monsoon. Rudraprayag bore the brunt of the disaster with a large number of structures including shrines, hotels, rest houses, commercial and residential buildings collapsing like a pack of cards in the district.
 
 

Tuesday, August 14, 2012

struts

1. Introduction

    "Read the directions and directly you will be directed in the right direction."

The framework documentation is written for active web developers and assumes a working knowledge about how Java web applications are built. For more about the underlying nuts and bolts, see the Key Technologies Primer.

1.1 Forward into the Past! (or a brief history of Struts)

When Java servlets were first invented, many programmers quickly realized that they were a Good Thing. They were faster and more powerful that standard CGI, portable, and infinitely extensible.

But writing HTML to send to the browser in endless println() statements was tiresome and problematic. The answer to that was JavaServer Pages, which turned Servlet writing inside-out. Now developers could easily mix HTML with Java code, and have all the advantages of servlets. The sky was the limit!

Java web applications quickly became "JSP-centric". This in-and-of itself was not a Bad Thing, but it did little to resolve flow control issues and other problems endemic to web applications.

Clearly, another paradigm was needed ...

Many clever developers realized that JavaServer Pages AND servlets could be used together to deploy web applications. The servlets could help with the control-flow, and the JSPs could focus on the nasty business of writing HTML. In due course, using JSPs and servlets together became known as Model 2 (meaning, presumably, that using JSPs alone was Model 1).

Of course, there is nothing new under the Sun ... and many have been quick to point out that JSP's Model 2 follows the classic Model-View-Controller design pattern abstracted from the venerable Smalltalk MVC framework. Java Web developers now tend to use the terms Model 2 and MVC interchangeably. In this guide, we use the MVC paradigm to describe the framework architecture, which might be best termed a Model 2/MVC design.

The Apache Struts Project was launched in May 2000 by Craig R. McClanahan to provide a standard MVC framework to the Java community. In July 2001, version 1.0 was released, and IOHO, Java Model 2 development has never been quite the same.

1.2 The Model-View-Controller ('MVC') Design Pattern

The term "MVC" originated with the SmallTalk Model-View-Controller framework. Under MVC, an application is seen as having three distinct parts. The problem domain is represented by the Model. The output to the user is represented by the View. And, the input from the user is represented by Controller.

1.2.1 The Model: System State and Business Logic JavaBeans

The Model portion of an MVC-based system can be often be divided into two major subsystems -- the internal state of the system and the actions that can be taken to change that state.

In grammatical terms, we might think about state information as nouns (things) and actions as verbs (changes to the state of those things).

Many applications represent the internal state of the system as a set of one or more JavaBeans. The bean properties represent the details of the system' state. Depending on your application's complexity, these beans may be self contained (and know how to persist their own state), or they may be facades that know how to retrieve the system's state from another component. This component may be a database, a search engine, an Entity Enterprise JavaBean, a LDAP server, or something else entirely.

Large-scale applications will often represent the set of possible business operations as methods that can be called on the bean or beans maintaining the state information. For example, you might have a shopping cart bean, stored in session scope for each current user, with properties that represent the current set of items that the user has decided to purchase. This bean might also have a checkOut() method that authorizes the user's credit card and sends the order to the warehouse to be picked and shipped. Other systems will represent the available operations separately, perhaps as Session Enterprise JavaBeans (Session EJBs).

In a smaller scale application, on the other hand, the available operations might be embedded within the Action classes that are part of the framework control layer. This can be useful when the logic is very simple or where reuse of the business logic in other environments is not contemplated.

The framework architecture is flexible enough to support most any approach to accessing the Model, but we strongly recommend that you separate the business logic ("how it's done") from the role that Action classes play ("what to do"). 'nuff said.

For more about adapting your application's Model to the framework, see the Building Model Components chapter.

1.2.2 The View: JSP Pages and Presentation Components

The View portion of a Struts-based application is most often constructed using JavaServer Pages (JSP) technology. JSP pages can contain static HTML (or XML) text called "template text", plus the ability to insert dynamic content based on the interpretation (at page request time) of special action tags. The JSP environment includes a set of standard action tags, such as whose purpose is described in the JavaServer Pages Specification. In addition to the built-in actions, there is a standard facility to define your own tags, which are organized into "custom tag libraries."

The framework includes a set of custom tag libraries that facilitate creating user interfaces that are fully internationalized and interact gracefully with ActionForm beans. ActionForms capture and validate whatever input is required by the application.

For more about the Struts taglibs and using presentation pages with the framework, see the Building View Components section. Additional documentation regarding the taglibs is also available in the Taglibs subproject.

1.2.3 The Controller: ActionServlet and ActionMapping

Struts provides the Controller portion of the application. The Controller is focused on receiving requests from the client (typically a user running a web browser), deciding what business logic function is to be performed, and then delegating responsibility for producing the next phase of the user interface to an appropriate View component. The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings. An ActionMapping defines a path that is matched against the request URI of the incoming request and usually specifies the fully qualified class name of an Action class. All Actions are subclassed from [org.apache.struts.action.Action]. Actions encapsulate calls to business logic classes, interpret the outcome, and ultimately dispatch control to the appropriate View component to create the response. While the framework dispatches to a View, actually rendering the View is outside its scope.

The framework also supports the ability to use ActionMapping classes that have additional properties beyond the standard ones required to operate the controller. This allows you to store additional information specific to your application and still utilize the remaining features of the framework. In addition, the framework lets you define logical "names" to which control should be forwarded so that an action method can ask for the "Main Menu" page (for example), without knowing the location of the corresponding JSP page. These features greatly assist you in separating the control logic (what to do) with the view logic (how it's rendered).

For more about the control layer, see the Building Controller Components chapter.

1.3 Framework Control Flow

The framework provides several components that make up the Control layer of a MVC-style application. These include a controller component (servlet), developer-defined request handlers, and several supporting objects.

The Struts Taglib component provides direct support for the View layer of a MVC application. Some of these tags access the control-layer objects. Others are generic tags found convenient when writing applications. Other taglibs, including JSTL, can also be used with the framework. Other presentation technologies, like Velocity Templates and XSLT can also be used with the framework.

The Model layer in a MVC application is often project-specific. The framework is designed to make it easy to access the business-end of your application, but leaves that part of the programming to other products, like JDBC, Enterprise Java Beans,Object Relational Bridge, or iBATIS, to name a few.

Let's step through how this all fits together.

When initialized, the controller parses a configuration file (struts-config.xml) and uses it to deploy other control layer objects. Together, these objects form the Struts Configuration. The Configuration defines (among other things) the collection of ActionMappings[org.apache.struts.action.ActionMappings] for an application.

The controller component consults the ActionMappings as it routes HTTP requests to other components in the framework. Requests may be forwarded to JavaServer Pages or Action[org.apache.struts.action.Action] subclasses provided by the application developer. Often, a request is first forwarded to an Action and then to a JSP (or other presentation page). The mappings help the controller turn HTTP requests into application actions.

An individual ActionMapping[org.apache.struts.action.ActionMapping] will usually contain a number of properties including:

    a request path (or "URI"),
    the object type (Action subclass) to act upon the request, and
    other properties as needed.

The Action object can handle the request and respond to the client (usually a Web browser) or indicate that control should be forwarded elsewhere. For example, if a login succeeds, a login action may wish to forward the request onto the mainMenu page.

Action objects have access to the application's controller component, and so have access to that members's methods. When forwarding control, an Action object can indirectly forward one or more shared objects, including JavaBeans, by placing them in one of the standard contexts shared by Java Servlets.

For example, an Action object can create a shopping cart bean, add an item to the cart, place the bean in the session context, and then forward control to another mapping. That mapping may use a JavaServer Page to display the contents of the user's cart. Since each client has their own session, they will each also have their own shopping cart.

Most of the business logic in an application can be represented using JavaBeans. An Action can call the properties of a JavaBean without knowing how it actually works. This encapsulates the business logic, so that the Action can focus on error handling and where to forward control.

JavaBeans can also be used to manage input forms. A key problem in designing Web applications is retaining and validating what a user has entered between requests. You can define your own set of input bean classes, by subclassing ActionForm[org.apache.struts.action.ActionForm]. The ActionForm class makes it easy to store and validate the data for your application's input forms. The ActionForm bean is automatically saved in one of the standard, shared context collections, so that it can be used by other objects, like an Action object or another JSP.

The form bean can be used by a JSP to collect data from the user ... by an Action object to validate the user-entered data ... and then by the JSP again to re-populate the form fields. In the case of validation errors, the framework has a shared mechanism for raising and displaying error messages.

Another element of the Configuration are the ActionFormBeans[org.apache.struts.action.ActionFormBeans]. This is a collection of descriptor objects that are used to create instances of the ActionForm objects at runtime. When a mapping needs an ActionForm, the servlet looks up the form-bean descriptor by name and uses it to create an ActionForm instance of the specified type.

Here is the sequence of events that occur when a request calls for an mapping that uses an ActionForm:

    The controller servlet either retrieves or creates the ActionForm bean instance.
    The controller servlet passes the bean to the Action object.
    If the request is being used to submit an input page, the Action object can examine the data. If necessary, the data can be sent back to the input form along with a list of messages to display on the page. Otherwise the data can be passed along to the business tier.
    If the request is being used to create an input page, the Action object can populate the bean with any data that the input page might need.

The Struts Taglib component provides custom tags that can automatically populate fields from a JavaBean. All most JavaServer Pages really need to know is the field names to use and where to submit the form.

Other tags can automatically output messages queued by an Action or ActionForm and simply need to be integrated into the page's markup. The messages are designed for localization and will render the best available message for a user's locale.

The framework and Struts Taglib were designed from the ground-up to support the internationalization features built into the Java platform. All the field labels and messages can be retrieved from a message resource. To provide messages for another language, simply add another file to the resource bundle.

Internationalism aside, other benefits to the message resources approach are consistent labeling between forms, and the ability to review all labels and messages from a central location.

For the simplest applications, an Action object may sometimes handle the business logic associated with a request. However, in most cases, an Action object should invoke another object, usually a JavaBean, to perform the actual business logic. This lets the Action focus on error handling and control flow, rather than business logic. To allow reuse on other platforms, business-logic JavaBeans should not refer to any Web application objects. The Action object should translate needed details from the HTTP request and pass those along to the business-logic beans as regular Java variables.

In a database application, for example:

    A business-logic bean will connect to and query the database,
    The business-logic bean returns the result to the Action,
    The Action stores the result in a form bean in the request,
    The JavaServer Page displays the result in a HTML form.

Hibernate


Hibernate (Java)


Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Hibernate solves object-relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions.

Hibernate is free software that is distributed under the GNU Lesser General Public License.

Hibernate's primary feature is mapping from Java classes to database tables (and from Java data types to SQL data types). Hibernate also provides data query and retrieval facilities. It also generates the SQL calls and attempts to relieve the developer from manual result set handling and object conversion and keep the application portable to all supported SQL databases with little performance overhead.



Mapping
Mapping Java classes to database tables is accomplished through the configuration of an XML file or by using Java Annotations. When using an XML file, Hibernate can generate skeletal source code for the persistence classes. This is unnecessary when annotations are used. Hibernate can use the XML file or the annotations to maintain the database schema.

Facilities to arrange one-to-many and many-to-many relationships between classes are provided. In addition to managing associations between objects, Hibernate can also manage reflexive associations where an object has a one-to-many relationship with other instances of its own type.

Hibernate supports the mapping of custom value types. This makes the following scenarios possible:

    Overriding the default SQL type that Hibernate chooses when mapping a column to a property.
    Mapping Java Enum to columns as if they were regular properties.
    Mapping a single property to multiple columns.


Persistence

Hibernate provides transparent persistence for Plain Old Java Objects (POJOs). The only strict requirement for a persistent class is a no-argument constructor, not necessarily public. Proper behavior in some applications also requires special attention to the equals() and hashCode() methods.[1]

Collections of data objects are typically stored in Java collection objects such as Set and List. Java generics, introduced in Java 5, are supported. Hibernate can be configured to lazy load associated collections. Lazy loading is the default as of Hibernate 3.

Related objects can be configured to cascade operations from one to the other. For example, a parent such as an Album object can be configured to cascade its save and/or delete operation to its child Track objects. This can reduce development time and ensure referential integrity. A dirty checking feature avoids unnecessary database write actions by performing SQL updates only on the modified fields of persistent objects.

Hibernate Query Language (HQL)

Hibernate provides an SQL inspired language called Hibernate Query Language (HQL) which allows SQL-like queries to be written against Hibernate's data objects. Criteria Queries are provided as an object-oriented alternative to HQL.
Integration

Hibernate can be used both in standalone Java applications and in Java EE applications using servlets, EJB session beans, and JBI service components. It can also be included as a feature in other programming languages. For example, Adobe integrated Hibernate into version 9 of ColdFusion (which runs on J2EE app servers) with an abstraction layer of new functions and syntax added into CFML.
Entities and components

In Hibernate jargon, an entity is a stand-alone object in Hibernate's persistent mechanism which can be manipulated independently of other objects. In contrast, a component is subordinate to other entities and can be manipulated only with respect to other entities. For example, an Album object may represent an entity but the Tracks object associated with the Album objects would represent a component of the Album entity if it is assumed that Tracks can only be saved or retrieved from the database through the Album object. Unlike J2EE, it can switch databases.
History

Hibernate was started in 2001 by Gavin King as an alternative to using EJB2-style entity beans. Its mission back then was to simply offer better persistence capabilities than offered by EJB2 by simplifying the complexities and allowing for missing features.

Early in 2003, the Hibernate development team began Hibernate2 releases which offered many significant improvements over the first release.

JBoss, Inc. (now part of Red Hat) later hired the lead Hibernate developers and worked with them in supporting Hibernate.

In 2010, Hibernate version 3.x was released with the features like: a new Interceptor/Callback architecture, user defined filters, and JDK 5.0 Annotations (Java's metadata feature). As of 2010 Hibernate 3 (version 3.5.0 and up) was a certified implementation of the Java Persistence API 2.0 specification via a wrapper for the Core module which provides conformity with the JSR 317 standard.[2]

In Dec 2011, Hibernate Core 4.0.0 Final was released. This includes new features like: Initial multi-tenancy support, Introduction of ServiceRegistry (which is a major change in how Hibernate builds and manages "services"), Clean up of Session opening from SessionFactory, Improved integration via org.hibernate.integrator.spi.Integrator and auto discovery, Improved logging with i18n support and message codes, Initial work on more clear split between API, SPI and implementation classes, Clean up of deprecated methods, classes, etc.[3]

In 2012, Hibernate 5 started development. It will contain JPA 2.1 support.
Application programming interface

The Hibernate API is provided in the Java package org.hibernate.
org.hibernate.SessionFactory interface

References immutable and threadsafe object creating new Hibernate sessions. Hibernate-based applications are usually designed to make use only of a single instance of the class implementing this interface (often exposed using a singleton design pattern).
org.hibernate.Session interface

Represents a Hibernate session i.e. the main point of the manipulation performed on the database entities. The latter activities include (among the other things) managing the persistence state (transient, persisted, detached[clarification needed]) of the objects, fetching the persisted ones from the database and the management of the transaction demarcation[clarification needed].

A session is intended to last as long as the logical transaction on the database. Due to the latter feature, Session implementations are not expected to be threadsafe nor to be used by multiple clients.
Software components

The Hibernate software includes the following components:[4]


    Hibernate ORM (was known as Hibernate Core before release 4.1[5]) – the base software for an object-relational mapping solution for Java environments[6]
    Hibernate Annotations (merged into Hibernate Core/ORM since version 3.6[7]) – metadata that governs the transformation of data between the object-oriented model and the relational database model according to the JSR 317 Java Persistence API (JPA 2)[8]
    Hibernate EntityManager – together with Hibernate Annotations, a wrapper that implements a JSR 317 Java Persistence API (JPA 2) persistence solution on top of Hibernate Core[9]
    Hibernate Envers – auditing and versioning of persistent classes[10]
    Hibernate OGM – Object/Grid Mapper is an extension to store data in a NoSQL store[11]
    Hibernate Shards – horizontal partitioning for multiple relational databases[12]
        NOTE: Hibernate Shards is not compatible with the 4.x versions of Hibernate Core... some of the Shards capability was integrated into Core in the 4.0 release.
    Hibernate Search – integrates the full text library functionality from Apache Lucene in the Hibernate and JPA model[13]
    Hibernate Tools – a set of tools implemented as a suite of Eclipse plugins and Ant tasks included in JBoss Developer Studio[14]
    Hibernate Validator – the reference implementation of JSR 303 Bean Validation[15]
    Hibernate Metamodel Generator – an annotation processor that creates JSR 317 Java Persistence API (JPA 2) static metamodel classes using the JSR 269 Pluggable Annotation Processing API[16]
    NHibernate – an object-relational mapping solution for the .NET Framework[17]

Monday, August 13, 2012

How to connect Java Application with Oracle Database using JDBC Driver



How to connect Java Application with Oracle Database using JDBC Driver -

Today I will go through the basic steps to connect a Java Application with Oracle Database using JDBC Driver (Java Database Connectivity). To develop Enterprise Product connectivity of java application and oracle database is essential. When I was new to java, i have faced some problem for java and database connectivity using jdbc. So I want to make all this process bit easier for all the new comer in java and windows platform.





Prerequisites :

    Microsoft Windows Xp Service Pack 2 or above.
    Java Developement Kit.
    Oracle Database.
    Oracle JDBC Driver.According to your database version.
    One Integrated Development Environment.like Netbeans,Eclipse

Steps for configuring the system and creating DSN (ODBC Data Source):

    1.Install Java Development Kit and Oracle Database.
    2.Place Oracle JDBC Driver (*.jar file) in java runtime folder and java development kit folder . eg: 'C:\Program Files\Java\jre1.6.0\lib\ext' and 'C:\Program Files\Java\jdk1.6.0\jre\lib\ext'.
   3. Create a Data Source Name (DSN) required for database connectivity in windows.
    For DSN go to Start->Control Panel->Administrative Tools->Data Sources (ODBC).
    4.ODBC Data Source Administrator will open. Click on the Add button to create a new data source.
    





5.Select 'Microsoft ODBC for Oracle' & click Next.



 7.Fill the Data Source Name - name for the data source, Description - Just a simple description, User Name - Oracle Database User name, Server - name of the server where database is installed ,( localhost - if it is installed in the local machine or the IP if the the database is installed in a remote machine). Click OK and close the ODBC Data Source Administrator.







Now, the system is configured to run any java oracle connectivity program.You can start coding the program in any IDE or open a notpad.

Below is the source code of a jdbc program to determine wheather all your setting are OK or not. Compile the program and execute it. If the program is executed without any error or exception and you get 'JDBC Driver loaded' and 'Connected to the Oracle Database' as output then you have done all the setting correctly and you are able to connect to the oracle database through your java program.
If you encounter any problem please get back to me, I will help you to sought out the problem.


Source code :

import java.sql.*;

public class ConnectOracle {

public static void main(String[] args) {
String driver="sun.jdbc.odbc.JdbcOdbcDriver"; //
String cs="jdbc:odbc:connectOracle"; //connectOracle is the data source name
String user = "system"; //username of oracle database
String pwd = "tom"; //password of oracle database
Connection con = null; //connection variable assigned to null
try
{
Class.forName(driver);// for loading the jdbc driver
}
catch(Exception e)
{
System.out.println(e);
}
System.out.println("JDBC Driver loaded");
try
{
con=DriverManager.getConnection(cs,user,pwd);// for establishing connection with database
}
catch(Exception e)
{
System.out.println(e);
}
System.out.println("Connected to the Oracle Database");
try
{
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
}//end of main()
}//end of class()

ODBC Driver for Access 2000, 2002, 2003 and 2007 Databases

The Easysoft ODBC-Access Driver connects 32-bit and 64-bit applications on Linux and Unix to Microsoft Access databases.

To ensure compatibility with databases created in as many versions of Access as possible, the Easysoft ODBC-Access Driver supports both the MDB and ACCDB database formats. The Easysoft ODBC-Access Driver can connect to .mdb databases created in Access 2000–2003 and Office Access 2007. The forthcoming release of Access, Office Access 2010, will continue to support .mdb format databases. The Easysoft ODBC-Access Driver can also connect to .accdb databases, which is the default format for databases created in Office Access 2007 and later. The Easysoft ODBC-Access Driver is a flexible, future-proof solution therefore, which will integrate Linux/Unix with whatever version of Access suits your organisation best.

The Easysoft ODBC-Access Driver provides read-write access to Access databases, so your Linux/Unix applications can update as well as retrieve Access data. If you need to restrict users to read-only access, you can configure the driver to open the database in read-only mode, just as you can with the Access front-end application on Windows.

Choosing the Easysoft ODBC-Access Driver to connect Linux/Unix with Access will not disrupt your existing Access solution’s environment or users. There is no software to install on your Windows machines. You do not need to change where your database file is located. The Easysoft ODBC-Access Driver can open an Access database stored on a Windows share, so there is no need to copy the database file to your Linux/Unix machine. To ensure concurrent access to the database by Windows and Linux/Unix users is problem free, the Easysoft ODBC-Access Driver uses Access’ locking file mechanism. The driver will also prevent its users from opening a database if another user has the database opened for exclusive access, again mirroring the Access front-end’s behaviour for seamless integration.

The Easysoft ODBC-Access Driver supports encrypted/encoded .mdb files, which is an Access security feature that protects Access data from unauthorised viewing. When you use the Easysoft ODBC-Access Driver to load a remote .mdb file, encrypting/encoding the database protects the privacy of the Access data as it is sent across the network.

To ensure compatibility with multiple Linux/Unix applications, the Easysoft ODBC-Access Driver supports the unixODBC driver manager. Most (if not all) Linux/Unix applications support unixODBC, which, as a mature, non-proprietary, robust driver manager, is part of the standard installation of many Linux distributions. To provide a self-contained solution, the Easysoft ODBC-Access Driver distribution itself includes the unixODBC driver manager. To get you going quickly, the Easysoft ODBC-Access Driver automatically installs itself into unixODBC, making the driver immediately available to your applications.
Platforms

The Easysoft ODBC-Access Driver is currently available on these platforms:
Version     Platform     Distribution
v1.0 (Access 2000 - 2007)     AIX (PPC) (32 - Bit)     (4.3-6.1)
v1.0 (Access 2000 - 2007)     AIX (PPC) (64 - Bit)     (5.0-6.1)
v1.0 (Access 2000 - 2007)     HP-UX (Itanium i64) (32 - Bit)     (11i)
v1.0 (Access 2000 - 2007)     HP-UX (Itanium i64) (64 - Bit)     (11i)
v1.0 (Access 2000 - 2007)     HP-UX (PA-Risc) (32 - Bit)     (10.10-11)
v1.0 (Access 2000 - 2007)     HP-UX (PA-Risc 2) (64 - Bit)     (11)
v1.0 (Access 2000 - 2007)     Linux (x86) (32 - Bit)     (kernel 2.2-2.6, glibc 2.1+)
v1.0 (Access 2000 - 2007)     Linux (x86) (64 - Bit)     (kernel 2.6, glibc 2.3.5)
v1.0 (Access 2000 - 2007)     Solaris (Sparc) (32 - Bit)     (2.6-2.10)
v1.0 (Access 2000 - 2007)     Solaris (Sparc) (64 - Bit)     (2.8-2.10)
v1.0 (Access 2000 - 2007)     Solaris (x86) (32 - Bit)     (2.8)
v1.0 (Access 2000 - 2007)     Solaris (x86) (64 - Bit)     (2.8)

If the Access ODBC driver is not available for your platform, we have an alternative Access solution, which is available for additional Unix platforms.

Download Access ODBC driver.
MSAccess Linux ODBC Driver

Connects to MS Access databases (.mdb or .accdb) from 32-bit and 64-bit Linux platforms such as CentOS, Debian GNU/Linux, Fedora, Kubuntu/Ubuntu (Edgy Eft/Feisty Fawn/Gutsy Gibbon/Hardy Heron/Intrepid Ibex/Jaunty Jackalope/Karmic Koala), Mandrake/Mandriva, OpenSUSE/SUSE, Red Hat, Slackware and more.
MSAccess Unix ODBC Driver

Connects to MS Access databases (.mdb or .accdb) from 32-bit and 64-bit IBM AIX, HP-UX and Sun Solaris platforms.