Posts

Showing posts with the label Frame Works

Hibernate-4

Image
6.Query languages Q-A)Why we need a query language in hibernate. for join quires. for update PK. JPQL queries can use in HQL,But HQL queries cant use JPQL. SQL queries cant use in JPQL & JPQL  queries cant use in SQL. SQL include all DDL,DML quires. But JPQL & HQL include DML quires. JPQL include UPDATE,DELETE,SELECT quires. HQL include UPDATE,DELETE,SELECT,INSERT INTO... SELECT quires.  NH Vs JPAH differences in session vs entity manager                     Should be considered:-(R):return type                                                                :-(Q):query language 1.Get data CreateQuery vs CreateQuery (R)Query/TypeQuery vs Query/TypeQuery (Q)JPQL/HQL vs JPQL(Cant use for the SQL) 2.List of data list() vs getResultList() 3.UniqueResult(0 vs getSingleResult() 4.addEntity vs <not define> 5.getNameQuery  vs createNamedQuery 6.getNamedNativeQuery Vs CreateNameQuery Parameters Using mixture of these parameters is no not a good practice a)Positional Parameters use

Hibernate-3

Image
Cont..Hibernate-2  (5.2)By-Directional Relationship In a bi-directional relation both sides know about the other side.So both sides can access another side. Owner end data can fetch using inverse end & inverse end data can fetch using owner end Criteria:      1. Selection of one entity to exchange pk to fk or DBMS  rules      2.Using @JoinTable      3.Decomposing    (1)1-1 Relationship 1-1(Total participation) 1. Selection of one entity to exchange pk to fk or DBMS  rules Girl.java @NoArgsConstructor @AllArgsConstructor @Getter @Setter @ToString @Entity public class Girl {      @Id      private int id;      private String name;      @OneToOne //If do not add unique=true it will be not a 1-1 relationship,It will be 1-m      @JoinColumn(name="boy_id", referencedColumnName = "id",unique = true)      private Boy boy; } Boy.java @NoArgsConstructor @AllArgsConstructor @Getter @Setter @ToString(exclude = "girl") @Entity public class Boy {     @Id     pr

Hibernate-2

Image
 count from....Hibernate-1 JPAH-JPA Hibernate NH-Native Hibernate 4.Persistence Context & Persistence State   Persistence State:Forms of entity which will navigate the hibernate. 1.Transient State New records are stored as transient state 2.Detached State If there is any content in the detached state it must be in the DB. merge detached entity step 1-create a clone from detached entity,but dont know the memory location of that entity. step2-using select query check weather availability  of the record. step 3-merge with the persistence context's entity.  3.Managed State If the entity is in persistence context will called as the manage state,In this state dirty checking feature activated in the entity object.If we want to update any thing in the db we want to put that in to the persistence context.All the content in the persistence context will flush(),after the commit  session.contains(entity name-->Check whether entity is in the persistence context) After fetched(get or find

Hibernate-1

Image
1.INTRODUCTION Java EE(Enterprise edition Java) Simply EE focus to develop enterprise application development.The aim of the Java EE platform is to provide developers with a powerful set of APIs while shortening development time, reducing application complexity, and improving application performance. Java EE vs Java SE JDK(Java Development Kit)     Java SE API     JRE(JVM)     Development Tools(Eg:-Javac,Serial version UID,etc) Java EE based on java SE.In the java SE we can develop anything;Also EE application but that develop must concern cross cutting component.But in the Java EE developer can focus one develop the business logic, Lesley thinking about security,transaction,error handling,login etc. JAVA SE gives a collection of specification(like documentation)+their implementation. JAVA SE gives  only specification.So several external companies implement that methods several ways Eg:-Hibernate,Jetty,Apache Tom Cat,Glass fish                      Companies implement java EE specific