Submitted by sneha on Sun, 04/15/2018 - 06:11
There might be situations where you would want to modify the attributes of the embedded class (eg. Address) within an embedding class (eg. User), for instance, changing the database column name for a field.
We can use @AttributeOverride annotation to override the details of a field of the embedded class and then enclose all such @AttributeOverride annotations inside @AttributeOverrides annotation.
Submitted by sneha on Sun, 04/15/2018 - 06:09
Submitted by sneha on Sun, 04/15/2018 - 06:07
Here we will discuss most commonly used basic annotations in hibernate - @Entity, @Table, @Id, @GeneratedValue, @Column, @Basic, @Transient, @Temporal and @Lob. Even though many annotations has both JPA (java.persistance) and hibernate (org.hibernate) versions, it is preferred to use JPA annotations whenever possible. As you can see below, some of the hibernate specific annotations are already deprecated.
Submitted by sneha on Sun, 04/15/2018 - 06:06
A java object within a hibernate application can be in one of the three states:
-
New/transient
-
Attached/persistent
-
Detached
Important points about object states in Hibernate
Submitted by sneha on Sun, 04/15/2018 - 06:04
CRUD operations are Create(save), Read(select), Update(update) and Delete(delete).
Examples discussed here need to be tried out on top of the lab done @ http://javajee.com/lab-your-first-hibernate-43-program.
Session
Select, Save, update and delete operations in hibernate should be called within a session:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Pages