Join problem with JPA Criteria Builder

Join problem with JPA Criteria Builder

I need to make this Query in criteria Builder. At this momento I�´m making it like this:

Root<Setting> settingRoot = cr.from(Setting.class);
    Join<Setting, SettingValue> settingValueRoot = settingRoot.join("SettingValues", JoinType.LEFT);


    if (filter.settingLevel == SettingData.SETTING_LEVEL_USER) {
        Join<SettingValue, User> userRoot = settingValueRoot.join("User", JoinType.LEFT);
        setCriteriaQuery(cb, cr, filter, settingRoot, settingValueRoot, userRoot);  

And the query I get is the next one:

select setting0_.code as col_0_0_, setting0_.setting_name as col_1_0_, setting0_.setting_level as col_2_0_, settingsgr3_.setting_group_name as col_3_0_, setting0_.setting_order as col_4_0_, settingval1_.setting_value as col_5_0_, user2_.name as col_6_0_, user2_.id as col_7_0_, settingsgr3_.group_order as col_8_0_, setting0_.settings_group_id as col_9_0_, setting0_.data_type as col_10_0_, setting0_.multiple as col_11_0_, setting0_.edit_mode as col_12_0_, setting0_.super_edit_mode as col_13_0_, setting0_.action_required as col_14_0_, setting0_.setting_configuration as col_15_0_, settingdef5_.default_value as col_16_0_ from currentds.icm_setting setting0_ left outer join currentds.icm_setting_value settingval1_ on setting0_.code=settingval1_.setting_code left outer join currentds.icm_user user2_ on settingval1_.user_id=user2_.id, currentds.icm_settings_group settingsgr3_, currentds.icm_setting_default_value settingdef5_ where setting0_.settings_group_id=settingsgr3_.id and setting0_.code=settingdef5_.setting_code and setting0_.setting_level=1 and (settingval1_.user_id=1 or settingval1_.user_id is null)

But the query I need is this

SELECT icm_user.id,*
FROM ICM_setting
     LEFT JOIN (
         icm_setting_value INNER JOIN icm_user ON icm_setting_value.user_id = icm_user.id
     ) ON ICM_setting.code = icm_setting_value.setting_code AND icm_setting_value.user_ID=1
     WHERE ICM_SETTING.SETTING_LEVEL=1

Any help?

View Answers









Related Tutorials/Questions & Answers:
Join problem with JPA Criteria Builder
Join problem with JPA Criteria Builder  I need to make this Query in criteria Builder. At this momento IÃ?´m making it like this: Root<... join currentds.icm_setting_value settingval1_ on setting0_.code=settingval1
join multiple tables via hibernate criteria - Hibernate
join multiple tables via hibernate criteria  Dear all, i have a problem working with hibernate. i wanna join multiple tables via hibernate criteria. How can i do this operation? Thanks in advance regards Rosa
Advertisements
Hibernate Criteria Join
Hibernate Criteria Join API Hibernate Criteria JOIN API allows users to perform join operation. Suppose you have to perform a operation like SELECT S.*, C.... Read More about the restriction on Criteria. A Simple class of criteria join
Hibernate Criteria Join
query, one of them is Hibernate Criteria Join which performs join operation... of Hibernate Criteria join: SelectCriteria.java package net.roseindia.main... Resources:ADS_TO_REPLACE_4 Hibernate Criteria Join
ModuleNotFoundError: No module named 'xblock-problem-builder'
ModuleNotFoundError: No module named 'xblock-problem-builder'  Hi...: No module named 'xblock-problem-builder' How to remove the ModuleNotFoundError: No module named 'xblock-problem-builder' error? Thanks   Hi
ModuleNotFoundError: No module named 'xblock-problem-builder'
ModuleNotFoundError: No module named 'xblock-problem-builder'  Hi...: No module named 'xblock-problem-builder' How to remove the ModuleNotFoundError: No module named 'xblock-problem-builder' error? Thanks   Hi
Version of com.blazebit>blaze-persistence-jpa-criteria dependency
List of Version of com.blazebit>blaze-persistence-jpa-criteria dependency
Maven Dependency blaze-persistence-jpa-criteria >> 1.2.0-Alpha1
You should include the dependency code given in this page to add Maven Dependency of com.blazebit >> blaze-persistence-jpa-criteria version1.2.0-Alpha1 in your project
Maven Dependency blaze-persistence-jpa-criteria >> 1.2.0-Alpha2
You should include the dependency code given in this page to add Maven Dependency of com.blazebit >> blaze-persistence-jpa-criteria version1.2.0-Alpha2 in your project
Maven Dependency blaze-persistence-jpa-criteria >> 1.2.0-Alpha3
You should include the dependency code given in this page to add Maven Dependency of com.blazebit >> blaze-persistence-jpa-criteria version1.2.0-Alpha3 in your project
com.blazebit - blaze-persistence-jpa-criteria version 1.6.7 Maven dependency. How to use blaze-persistence-jpa-criteria version 1.6.7 in pom.xml?
com.blazebit  - Version 1.6.7 of blaze-persistence-jpa-criteria Maven...-persistence-jpa-criteria in pom.xml? How to use blaze-persistence-jpa-criteria version... it easy to use com.blazebit  - Version 1.6.7 of blaze-persistence-jpa-criteria
Maven Repository/Dependency: com.blazebit | blaze-persistence-jpa-criteria
Maven Repository/Dependency of Group ID com.blazebit and Artifact ID blaze-persistence-jpa-criteria. Latest version of com.blazebit:blaze-persistence-jpa-criteria dependencies. # Version Release Date
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.3.0-Alpha1
-persistence-jpa-criteria version 1.3.0-Alpha1. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.3.0-Alpha1 Java library... Dependency for blaze-persistence-jpa-criteria version 1.3.0-Alpha1
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.2.1
-persistence-jpa-criteria version 1.2.1. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.2.1 Java library in your... for blaze-persistence-jpa-criteria version 1.2.1 In this section have given
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.4.0-Alpha4
-persistence-jpa-criteria version 1.4.0-Alpha4. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.4.0-Alpha4 Java library... Dependency for blaze-persistence-jpa-criteria version 1.4.0-Alpha4
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.4.0-Alpha3
-persistence-jpa-criteria version 1.4.0-Alpha3. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.4.0-Alpha3 Java library... Dependency for blaze-persistence-jpa-criteria version 1.4.0-Alpha3
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.4.0-Alpha2
-persistence-jpa-criteria version 1.4.0-Alpha2. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.4.0-Alpha2 Java library... Dependency for blaze-persistence-jpa-criteria version 1.4.0-Alpha2
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.4.0-Alpha1
-persistence-jpa-criteria version 1.4.0-Alpha1. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.4.0-Alpha1 Java library... Dependency for blaze-persistence-jpa-criteria version 1.4.0-Alpha1
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.3.2
-persistence-jpa-criteria version 1.3.2. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.3.2 Java library in your... for blaze-persistence-jpa-criteria version 1.3.2 In this section have given
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.3.1
-persistence-jpa-criteria version 1.3.1. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.3.1 Java library in your... for blaze-persistence-jpa-criteria version 1.3.1 In this section have given
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.3.0
-persistence-jpa-criteria version 1.3.0. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.3.0 Java library in your... for blaze-persistence-jpa-criteria version 1.3.0 In this section have given
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.3.0-Alpha3
-persistence-jpa-criteria version 1.3.0-Alpha3. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.3.0-Alpha3 Java library... Dependency for blaze-persistence-jpa-criteria version 1.3.0-Alpha3
Maven, Gradle, SBT, Ivy, Grape, Leiningen and Buildr Dependency for blaze-persistence-jpa-criteria version 1.3.0-Alpha2
-persistence-jpa-criteria version 1.3.0-Alpha2. You can add these depency in your project to get com.blazebit:blaze-persistence-jpa-criteria:1.3.0-Alpha2 Java library... Dependency for blaze-persistence-jpa-criteria version 1.3.0-Alpha2
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.3.0-Alpha2 is released. Learn to use blaze-persistence-jpa-criteria version 1.3.0-Alpha2 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.3.0-Alpha2. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.3.0-Alpha1 is released. Learn to use blaze-persistence-jpa-criteria version 1.3.0-Alpha1 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.3.0-Alpha1. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.2.1 is released. Learn to use blaze-persistence-jpa-criteria version 1.2.1 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.2.1. Developer can use this version ( com.blazebit
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.2.0 is released. Learn to use blaze-persistence-jpa-criteria version 1.2.0 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.2.0. Developer can use this version ( com.blazebit
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.2.0-RC1 is released. Learn to use blaze-persistence-jpa-criteria version 1.2.0-RC1 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.2.0-RC1. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.2.0-Alpha6 is released. Learn to use blaze-persistence-jpa-criteria version 1.2.0-Alpha6 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.2.0-Alpha6. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.2.0-Alpha5 is released. Learn to use blaze-persistence-jpa-criteria version 1.2.0-Alpha5 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.2.0-Alpha5. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.2.0-Alpha4 is released. Learn to use blaze-persistence-jpa-criteria version 1.2.0-Alpha4 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.2.0-Alpha4. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.2.0-Alpha3 is released. Learn to use blaze-persistence-jpa-criteria version 1.2.0-Alpha3 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.2.0-Alpha3. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.2.0-Alpha2 is released. Learn to use blaze-persistence-jpa-criteria version 1.2.0-Alpha2 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.2.0-Alpha2. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.2.0-Alpha1 is released. Learn to use blaze-persistence-jpa-criteria version 1.2.0-Alpha1 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.2.0-Alpha1. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.5.0-Alpha2 is released. Learn to use blaze-persistence-jpa-criteria version 1.5.0-Alpha2 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.5.0-Alpha2. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.5.0-Alpha1 is released. Learn to use blaze-persistence-jpa-criteria version 1.5.0-Alpha1 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.5.0-Alpha1. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.4.1 is released. Learn to use blaze-persistence-jpa-criteria version 1.4.1 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.4.1. Developer can use this version ( com.blazebit
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.4.0 is released. Learn to use blaze-persistence-jpa-criteria version 1.4.0 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.4.0. Developer can use this version ( com.blazebit
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.4.0-Alpha4 is released. Learn to use blaze-persistence-jpa-criteria version 1.4.0-Alpha4 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.4.0-Alpha4. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.4.0-Alpha3 is released. Learn to use blaze-persistence-jpa-criteria version 1.4.0-Alpha3 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.4.0-Alpha3. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.4.0-Alpha1 is released. Learn to use blaze-persistence-jpa-criteria version 1.4.0-Alpha1 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.4.0-Alpha1. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.3.2 is released. Learn to use blaze-persistence-jpa-criteria version 1.3.2 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.3.2. Developer can use this version ( com.blazebit
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.3.1 is released. Learn to use blaze-persistence-jpa-criteria version 1.3.1 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.3.1. Developer can use this version ( com.blazebit
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.3.0 is released. Learn to use blaze-persistence-jpa-criteria version 1.3.0 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.3.0. Developer can use this version ( com.blazebit
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.3.0-Alpha3 is released. Learn to use blaze-persistence-jpa-criteria version 1.3.0-Alpha3 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.3.0-Alpha3. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.6.0-Alpha1 is released. Learn to use blaze-persistence-jpa-criteria version 1.6.0-Alpha1 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.6.0-Alpha1. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.5.1 is released. Learn to use blaze-persistence-jpa-criteria version 1.5.1 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.5.1. Developer can use this version ( com.blazebit
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.5.0 is released. Learn to use blaze-persistence-jpa-criteria version 1.5.0 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.5.0. Developer can use this version ( com.blazebit
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.5.0-Alpha5 is released. Learn to use blaze-persistence-jpa-criteria version 1.5.0-Alpha5 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.5.0-Alpha5. Developer can use this version
Maven dependency for com.blazebit - blaze-persistence-jpa-criteria version 1.5.0-Alpha4 is released. Learn to use blaze-persistence-jpa-criteria version 1.5.0-Alpha4 in Maven based Java projects
-persistence-jpa-criteria released The developers of   com.blazebit - blaze-persistence-jpa-criteria project have released the latest version...-persistence-jpa-criteria library is 1.5.0-Alpha4. Developer can use this version

Ads