Sunday, November 2, 2014

Database


JPA setup - Controller Module -> persistence.xml contains all JPA entities JTA DS, class, properties, property Hibernate has a JPA implementaion + JPA is just a specification + it contains annotations

Hibernate - ORM framework for transaction management

Hibernate Life cycle - Transient Objects -> Persistence Object -> Detached Object

Hibernate Setup - hibernate.cfg.xml + mapping files *.hbm.xml

Hibernate Advantages - We can enable 2nd level cache + indexing + Denormalization + HQL

Hibernate Advantages Session Factory - thread safe immutable singleton objects supply

Hibernate Advantages session closing and exception handling are automated by hibernate template

Connection Pooling Connecting to database through pre-created set of resuable software objects. (It is a pattern)

JNDI Use In distributed enviroinments we can use JNDI to locate the resource by abstract resource-independent way.

Ways of creating a datasource 1. Manually call the JDBC driver manager class and create the DS
2. Connection Pooling
3. Distributed transaction

Transaction management using JDBC autocommit(), commit(), rollback()

Isolation Levels in JDBC TRANSACTION_SERIALIZABLE, TRANSACTION_READ_COMMITED, TRANSACTION_READ_UNCOMMITED, TRANSACTION_REPEATABLE_READ

Statement VS Prepared Statement Statement is used in static DB connection - Prepared Statement is used when multiple SQL statements run at the same time Statement does not accept parameters - Prepared Statement accepts parameters at runtime

Outer Join VS Inner Join Outer Join gives union of two sets - Inner join gives intersection of two sets

Triggers executes a set of operations when a particular operation is performed in DB

No comments:

Post a Comment