Submitted by sneha on Mon, 10/26/2015 - 08:31
Parameter binding is the process of binding a Java variable with an HQL statement. Using Parameter binding and not string concatenation for HQL statement creation will also guard against attacks like SQL injection.
Submitted by sneha on Mon, 10/26/2015 - 03:36
Hibernate provides a query language called Hibernate Query Language (HQL). HQL is similar to SQL in syntax, but HQL queries are written against Hibernate's entity objects, not database tables. Hibernate also provide Criteria Queries as an object-oriented alternative to HQL. Criteria Query is used to modify the objects and provide the restriction for the objects. Here we will see the basics of HQL and later in another tutorial we will see criteria queries.
Submitted by sneha on Sat, 10/24/2015 - 22:28
In the JOINED strategy, hibernate will create a separate table for all the classes in an inheritance hierarchy, and the tables are normalized. Columns that you receive as part of inheritance will be part of parent class and referred from subclass tables using a foreign key.
In this example, we will create and save three entity classes – Shape, Rectangle and Circle; where Rectangle and Circle extends from Shape.
Submitted by sneha on Sat, 10/24/2015 - 22:23
In the TABLE_PER_CLASS strategy, hibernate will create a separate table for all the classes in an inheritance hierarchy. It is still not normalized completely as inherited columns are repeated in all tables. For instance, Fields inherited from Shape such as id and fillcolor are repeated in all the tables.
In this example, we will create and save three entity classes – Shape, Rectangle and Circle; where Rectangle and Circle extends from Shape.
Submitted by sneha on Sat, 10/24/2015 - 22:12
In the SINGLE_TABLE strategy, hibernate will create a single table for all the classes in an inheritance hierarchy. There will be a discriminator column that tells us the class to which that row belongs.
In this example, we will create and save three entity classes – Shape, Rectangle and Circle; where Rectangle and Circle extends from Shape.
Pages