Tuesday, May 18, 2010

Named Queries

NamedQuery feature in Hibernate allows Queries to added in Entity or Mapping Documents.The Queries can be of HQL or SQL type.NamedQuery structure has a name and query part.The name identifies the Query and should be unique in the context.If there are multiple named queries for an Entity,it can be specified within a NamedQueries construct.
@NamedQueries({

@NamedQuery(
name = "findEmpByAge",
query = "from emp e where e.age>?"
),

@NamedQuery(
name = "findEmpByRole",
query = "from emp e where e.role=?"
)
})

Adding additional fields in @Entity Class

In the Entity class, the persistent fields are mapped with @Column construct.But there could be some computed or other fields which are not in the table but are required in the Entity class.Adding these additional fields in the entity would give rise to Invalid Identifier Exception.To avoid this,these additional fields can be used with @Transient construct.When the fields are marked as Transient ,they are not associated with the Session Factory and their instances would be destroyed by the GC.

Friday, May 14, 2010

Cloud Computing

Cloud computing is a technology that uses the Internet and central remote servers to deliver hosted services over the Internet. It allows consumers and businesses to use applications without any installation on the computer .This technology enhances the efficiency of computing by centralizing storage, memory, processing and bandwidth. Typical examples of Cloud Services is Email Services like Yahoo,G Mail etc.

The distinct characteristics that differentiate Cloud Services from traditional hosting are
(1) It is sold on demand, the consumer pays based on the usage similar to any other utilities like water ,electricity.
(2) It is fully managed by the provider (the consumer needs nothing but a personal computer and Internet access).

The Cloud are of 3 types
-A public cloud that sells services to anyone on the Internet
-A private cloud is a proprietary network or data center that has hosted services to limited audience.
-A virtual private cloud that uses public cloud resources but is available for limited audience.

Cloud Computing Services are broadly divided into three categories:
Infrastructure-as-a-Service ,in which the Cloud Service provides virtual server instances with unique IP addresses and blocks of storage on demand. Customers use the provider's application program interface (API) to start, stop, access and configure their virtual servers and storage.

Platform-as-a-service ,is a set of software and product development tools hosted on the provider's infrastructure. Developers create applications on the provider's platform over the Internet.

Software-as-a-service ,where the vendor supplies the hardware infrastructure, the software product and interacts with the user through a front-end portal. Services can be anything from Web-based email to inventory control and database processing. Because the service provider hosts both the application and the data, the end user can avail the services from any computer.