How to avoid implicit cross joins in JPA ?

How to avoid implicit cross joins in JPA ? When you join two tables and trying to select (column select) from the child table then you will come across this implicit cross join issues. For example we have two entities namely store, coupon and mapping follows, Store Entity: @Entity public class Store { @OneToMany(mappedBy = “store”) private List couponList; public

157 total views, 2 views today

» Read more

[Resolved] org.hibernate.hql.internal.ast.QuerySyntaxException: store is not mapped

[Resolved] org.hibernate.hql.internal.ast.QuerySyntaxException: store is not mapped I got this exception org.hibernate.hql.internal.ast.QuerySyntaxException: store is not mapped, because store is not my class name it should be Store (S – capital). When we are writing the HQL, it is mandatory to maintain the cases like how it is exactly. I have provided the sample issue and resolved one for your quick reference.

102 total views, 2 views today

» Read more

Join two tables using Hibernate in Spring Boot Example

Join two tables using Hibernate in Spring Boot Example: Many enterprise applications whichever using hibernate uses sql queries only for joins still and uses hibernate only for save/update operations. Today we are going to see how to use hibernate to join two tables. We are going to see how to get count(*) using hibernate along with group by function in

169 total views, 1 views today

» Read more

Spring Boot Native Query Example

Spring Boot Native Query Example: In Spring boot, database operations can be performed by implementing CrudRepository<Object, Long> in our @Repository interface. Here¬†Object is our entity class. @Query Annotation: We can execute nativeQueries using @Query annotation. Need to make the nativeQuery boolean to true and provide the native query to value parameter for @Query annotation.   Syntax: @Query(nativeQuery=true, value=”select s.store_name, s.store_url

119 total views, 2 views today

» Read more

JPA Predicate criteriabuilder example for beginners

JPA Predicate criteriabuilder example for beginners Predicate is an interface which extends Expression and can be used for conjunction or disjunction of restrictions.   Syntax to create a predicate: Predicate someCondition = criteriaBuilder.equal(affiliateUrlRoot.get(“shop_home_url”), “mirthbees”);     criteriaBuilder is a CriteriaBuilder, which can be created like this,   @PersistenceContext private EntityManager entityManager; CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); affiliateUrlRoot is the root of

135 total views, 1 views today

» Read more

Typescript Quick Notes for Angular Developers

Typescript Quick Notes for Angular Developers: As because of angular’s reach angular developers are forced to learn typescript. It is not tough but it is better to know the below basic syntax to code faster.   1. Converting array to JSON in typescript   selectedItems = []; JSON.stringify(this.selectedItems);       2. For loop in typescript   for(let item of

156 total views, 2 views today

» Read more

Multi select dropdown in Angular 4 Example

Multi select dropdown in Angular 4 Example:   Step 1: Install angular2 multiselect dropdown component npm install angular2-multiselect-dropdown   (or)   npm i –save angular2-multiselect-dropdown     Step 2: Import AngularMultiSelectModule ¬†into @NgModule   import { AngularMultiSelectModule } from ‘angular2-multiselect-dropdown/angular2-multiselect-dropdown’; @NgModule({ // … imports: [ AngularMultiSelectModule, ] // … })     Step 3: Import and use it in your

189 total views, 1 views today

» Read more

Spring Boot with CriteriaBuilder for Dynamic Search Queries

Spring Boot with CriteriaBuilder for Dynamic Search Queries: Spring Boot with CriteriaBuilder for Dynamic Search Queries: When you are developing an enterprise application, you have to provide a search option dynamically with “and” condition. Our grand father way to do is using stringbuilder to construct the query in java and return the result. But hibernate has provided criteria for the

155 total views, 5 views today

» Read more
1 2 3 59