JDO is
- a persistence technology
-allows you to create POJOs (plain old java objects) and persist them to the database
If you are an application programmer, you can use JDO technology to directly store your Java domain model instances into the persistent store (database). Alternatives to JDO include direct file I/O, serialization, JDBC, Enterprise JavaBeans (EJB), Bean-Managed Persistence (BMP) or Container-Managed Persistence (CMP) entity beans, and the Java Persistence API.
http://www.oracle.com/technetwork/java/index-jsp-135919.html
Java Data Objects (JDO) is a specification of Java object persistence. One of its features is a transparency of the persistence services to the domain model. JDO persistent objects are ordinary Java programming language classes (POJOs
persistence has been "broken out" of "EJB3 Core", and a new standard formed, the Java Persistence API (JPA). JPA uses the javax.persistence package
Significantly, javax.persistence will not require an EJB container, and thus will work within a Java SE environment as well, as JDO always has.
JPA, however, is an object-relational mapping (ORM) standard, while JDO is both an object-relational mapping standard and a transparent object persistence standard
JDO, from an API point of view, is agnostic to the technology of the underlying datastore, whereas JPA is targeted to RDBMS datastores (although there are several JPA providers that support access to non-relational datastores through the JPA API, such as DataNucleus and ObjectDB)
http://en.wikipedia.org/wiki/Java_Data_Objects
Apache JDO
Java Data Objects (JDO) is a standard way to access persistent data in databases, using plain old Java objects (POJO) to represent persistent data
The approach separates data manipulation (done by accessing Java data members in the Java domain objects) from database manipulation (done by calling the JDO interface methods).
http://db.apache.org/jdo/
Thursday, November 8, 2012
Wednesday, November 7, 2012
JPA vs Hibernate
Many enterprise Java developers use lightweight persistent objects provided by open-source frameworks or Data Access Objects instead of entity beans: entity beans and enterprise beans had a reputation of being too heavyweight and complicated, and one could only use them in Java EE application servers. Many of the features of the third-party persistence frameworks were incorporated into the Java Persistence API, and as of 2006 projects like Hibernate (version 3.2) and Open-Source Version TopLink Essentials have become implementations of the Java Persistence API.
JPA is really a specification
Hibernate provides an implementation of the JPA specification. Vendors providing EJB3.0 containers will also be providing an implementation of the JPA spec, so that means Sun and IBM WebSphere and Oracle and all the other handsome players in the industry will provide an implementatio
http://www.coderanch.com/t/218819/ORM/databases/Hibernate-vs-JPA
What is JPA?
JPA is a framework for managing relational data for Java. It can be used with applications utilizing JSE (Java Platform, Standard Edition) or JEE (Java Platform, Enterprise Edition). Its current version is JPA 2.0, which was released on 10 Dec, 2009. JPA replaced EJB 2.0 and EJB 1.1 entity beans (which were heavily criticized for being heavyweight by the Java developer community). Although entity beans (in EJB) provided persistence objects, many developers were used to utilizing relatively lightweight objects offered by DAO (Data Access Objects) and other similar frameworks instead. As a result, JPA was introduced, and it captured many of the neat features of the frameworks mentioned above
What is Hibernate?
Hibernate is a framework that can be used for object-relational mapping intended for Java programming language. More specifically, it is an ORM (object-relational mapping) library that can be used to map object-relational model in to conventional relational model. In simple terms, it creates a mapping between Java classes and tables in relational databases, also between Java to SQL data types. Hibernate can also be used for data querying and retrieving by generating SQL calls. Therefore, the programmer is relieved from the manual handling of result sets and converting objects. Hibernate is released as a free and open source framework distributed under GNU license. An implementation for JPA API is provided in Hibernate 3.2 and later versions.
What is the difference between JPA and Hibernate?
JPA is a framework for managing relational data in Java applications, while Hibernate is a specific implementation of JPA (so ideally, JPA and Hibernate cannot be directly compared). In other words, Hibernate is one of the most popular frameworks that implements JPA. Hibernate implements JPA through Hibernate Annotation and EntityManager libraries that are implemented on top of Hibernate Core libraries. Both EntityManager and Annotations follow the lifecycle of Hibernate. The newest JPA version (JPA 2.0) is fully supported by Hibernate 3.5. JPA has the benefit of having an interface that is standardized, so the developer community will be more familiar with it than Hibernate. On the other hand, native Hibernate APIs can be considered more powerful because its features are a superset of that of JPA.
http://www.differencebetween.com/difference-between-jpa-and-vs-hibernate/#ixzz2BXu2zE00
Labels:
java interview questions
Statement vs Prepared Statement
- Statement vs Prepared Statement
A prepared statement performs the following checks:
Makes sure that the tables and columns exist
Makes sure that the parameter types match their columns
Parses the SQL to make sure that the syntax is correct
Compiles and caches the compiled SQL so it can be re-executed without repeating these steps
http://stackoverflow.com/questions/8959036/statement-vs-prepared-statement-in-terms-of-precompilation
- The prepared statement concept is not specific to Java, it is a database concept. Statement precompiling means: when you execute a SQL query, database server will prepare a execution plan before executing the actual query, this execution plan will be cached at database server for further execution.
The advantages of Prepared Statements are:
As the execution plan get cached, performance will be better.
It is a good way to code against SQL Injection as escapes the input values.
When it comes to a Statement with no unbound variables, the database is free to optimize to its full extent. The individual query will be faster, but the down side is that you need to do the database compilation all the time, and this is worse than the benefit of the faster query.
http://webmoli.com/2008/10/23/back-to-basics-statement-vs-prepared-statement/
Labels:
java interview questions
ls command howto
Output from
picard@spnode15$
total 1600
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
picard@spnode15$
Let's look at this
File Type. The first position/character in this column describes what type of entry each horizontal line represents. The first character will usually be
-
= Regular File
d
= Directory
You can tell, just by looking at the output from
Permissions. The rest of the first column (after the
Directory Entries (and Hard-Link Count). The next column (immediately to the right of the access permissions) is a number which tells how many directory entries are under that item. For a regular file, this will typically be 1. For a directory, this will always be at least 2. The reason for this is that every directory always contains pointers to both itself, and its parent directory. You can see these two entries as the first two items in our example listing in Figure 12: the entries for
Owner. The next column to the right displays the
Group. The next column (mostly "STAFF" in our example) shows the name of the user group
Size. The next column shows the file size in bytes (characters).
Date/Time. The next 3 columns show the date and time the file was last
File Name. Finally, we have the file name. As discussed earlier, UNIX is very accommodating
http://docweb.cns.ufl.edu/docs/d0107/ar07s04.html
- Link counter
Most file systems that support hard links use reference counting.
On POSIX-compliant operating systems, such as
- Link count: File vs Directory
One
1. What is the link count of a file?
The link count of a file tells the total number of links a file has
The soft-link is not part of the link count since the soft-link's
2. How to find the link count of a file or directory?
any new file created will have a link count 1.
By default, a file will have a link count of 1
$ touch test.c
$ ln test.c test-
$
total 8
3145743
3145730
3145744 -
3145744 -
$ ln -s test.c test-
$
total 8
3145743
3145730
3145744 -
3145744 -
3145745
3. Does the link count decrease whenever the hard-link
When the hard link file
$
$
total 8
3145743
3145730
3145744 -
3145745
4. When does the link count of a directory change?
A directory "
link count of a directory minus 2 gives you the total number of sub-directories present in the directory.
$
$
$
$
$
3145746
http://www.theunixschool.com/2012/10/link-count-file-vs-directory.html
- Q1: The Unix
inode structure contains a reference count. What is the reference count for? Why can't wejust remove theinode without checking the reference count when a fileis deleted ?
- On a storage device,
a file or directory is contained in a collection of blocks
https://developer.ibm.com/tutorials/l-lpic1-104-6/
Labels:
linux
Sunday, November 4, 2012
n-tiered application
- The J2EE platform is a multi-tiered system
A tier is a logical or functional partitioning of a system
Client tier represents Web browser, a Java or other application, Applet, WAP phone etc. The client tier makes requests to the Web server who will be serving the request by either returning static content if it is present in the Web server or forwards the request to either Servlet or JSP in the application server for either static or dynamic content.
Presentation tier encapsulates the presentation logic required to serve clients. A Servlet or JSP in the presentation tier intercepts client requests, manages logons, sessions, accesses the business services, and finally constructs a response, which gets delivered to client.
Business tier provides the business services. This tier contains the business logic and the business data. All the business logic is centralized into this tier as opposed to 2-tier systems where the business logic is scattered between the front end and the backend. The benefit of having a centralized business tier is that same business logic can support different types of clients like browser, WAP, other stand-alone applications etc.
Integration tier is responsible for communicating with external resources such as databases, legacy systems, ERP systems, messaging systems like MQSeries etc. The components in this tier use JDBC, JMS, J2EE Connector Architecture (JCA) and some proprietary middleware to access the resource tier.
Resource tier is the external resource such as a database, ERP system, Mainframe system etc responsible for storing the data. This tier is also known as Data Tier or EIS (Enterprise Information System) Tier.
The advantages of a 3-tiered or n-tiered application:
3-tier or multi-tier architectures force separation among presentation logic, business logic and database logic
Manageability: Each tier can be monitored, tuned and upgraded independently and different people can have clearly defined responsibilities.
· Scalability: More hardware can be added and allows clustering (i.e. horizontal scaling).
· Maintainability: Changes and upgrades can be performed without affecting other components.
· Availability: Clustering and load balancing can provide availability.
· Extensibility: Additional features can be easily added.
http://allu.wordpress.com/2007/08/18/j2ee-3-tier-or-n-tier-architecture/
- In software engineering, multi-tier architecture (often referred to as n-tier architecture) is a client–server architecture in which presentation, application processing, and data management functions are logically separated. For example, an application that uses middleware to service data requests between a user and a database employs multi-tier architecture. The most widespread use of multi-tier architecture is the three-tier architecture.
http://en.wikipedia.org/wiki/Multitier_architecture
- Using J2EE to develop n-tier applications involves breaking apart the different layers in the two-tier architecture into multiple tiers. An n-tier application could provide separate layers for each of the following services:
Presentation: In a typical Web application, a browser running on the client machine handles presentation.
Dynamically generated presentation: Although a browser could handle some dynamically generated presentation, for the widest support of different browsers much of the action should be done on the Web server using JSPs, servlets, or XML (Extensible Markup Language) and XSL (Extensible Stylesheet Language).
Business logic: Business logic is best implemented in Session EJBs (described later).
Data access: Data access is best implemented in Entity EJBs (described later) and using JDBC.
Backend system integration: Integration with backend systems may use a variety of technologies. The best choice will depend upon the exact nature of the backend system.
http://www.javaworld.com/jw-12-2000/jw-1201-weblogic.html
Labels:
java
Subscribe to:
Posts (Atom)