Hibernate Mapping

Table per class hierarchy - means 1 single table for the entire hierarchical structure.
here in the xml of the superclass we mention the discriminator column so we know from which subclass the data is coming.

<discriminator column="dcolumn" type="string" length="5"/>
so the single table will have dcolumn that will have value specified by discriminator-value field of the xml for each subclass mentioned there.

So if B and C extends A then we will have 1 table.


Table per sub-class hierarchy - means 1 table each for every super and subclass.
So if B and C extends A then we will have 3 tables.

we use the joined-subclass tag in the xml

x number of classes = x number of tables in the database



Table per concrete class
So if B and C extends A then we will have 2 tables.

x number of derived classes = x number of tables in the database

union-subclass tag is used


CRUD in the REST world

For Create,Read,Update and Delete operations using JEE6-RESTful API - Use the respective annotations for each of these actions,

Read- @GET to access a resource.It processes http get requests.
Create - @POST means "create new" as in "Here is the input for creating a user, create it for me".Use POST for Create.
Create AND/OR Update -@PUT means "insert, replace if already exists" as in "Here is the data for user 5".Use Put for update.
Delete -@DELETE for a delete operation

Use @PATH annotation to first reach a resource URI before using the annotations subsequently.

PUT is idempotent. You can send the request 100 times and it will not matter. POST is not idempotent. If you send the request 100 times, you'll get 100 emails or 100 letters in your postal box.
A general rule: if you know the id or name of the item, use PUT. If you want the id or name of the item to be assigned by the receiving party, use POST.
POST versus PUT

Big Data - Hadoop

Manage BigData with Hadoop set of technologies - HDFS and Mapreduce.
Use Hadoop Distributed file System to index data and Mapreduce algorithm to access data.
HDFS - consists of a main branch called the name branch that contains the file locations in the server rack's file systems.So if a user enters a search term - it is first queried on the name branch where it fetches the file locations on the distributed file system.Each rack of file system returns a key-value pair of "search term-occurrences".
These are then combined together to have the total search results with all occurrences from all locations in the form of key-value pairs.

ERMaster for constructive database issue resolution

ERMaster is an open source project providing a UI representation for databases.

Whats important is that if you have missing database documentation - such as missing ER Diagrams or Database Dictionary - ERMaster can generate it for you.It has a much needed eclipse plugin for database UI visual representation.

It can generate

  1. ER Diagram - you can export this as image
  2. Database documentation -- HTML - Java API style
  3. DDL sql file
  4. Data dictionary

The eclipse plugin is very simple and easy to use.
More details can be found at the source forge home page for ERMaster