datanucleus


How to create a Datanucleus JPA 2.x query with CriteriaQuery that is based on values from an embedded map


Basically, I have an Entity (Simplified for question) like below:
#Entity
public class MyClass {
#Id
private String id;
#Basic
private String name;
#Embedded
#ElementCollection
#MapKeyColumn(name="configName")
#Column(name="configValue")
#CollectionTable
private Map<String, String> config = new HashMap<>();
...
}
When I construct a query with DataNucleus CriteriaQuery for JPA 2.x, I have a query value of:
Map> queryInput ......
where queryINput holds value like:
("k1", ("v1", "v3"))
("k2", ("v2", "v4"))
("k3", ("v3"))
Let's say config of (one MyClass instance) holds value as below:
("k1", ("v1"))
("k2", ("v2"))
("k3", ("v3"))
What I want to achieve is to search MyClass whenever all the keys of the input map matches all the keys of the config map and for each matched key, the value of the config map is in one of the values in the input map values, I will return MyClass. In the example above, the instance will be returned as it satisfy the criteria.
and both the below will fail:
("k1", ("v1"))
("k2", ("v2"))
//fail because k3 doesn't present.
or
("k1", ("v2")) //fail because v2 value is not in the query value list for key k1
("k2", ("v2"))
("k3", ("v3"))
How am I able to do that?
Thanks.

Related Links

How to load entity with its 1 to 1 relation in DataNucleus, using native SQL query with JOINS
How to fetch related object using JDOQL named query?
Datanucleus enhancement with Bazel
DN 4.0.x and oracle : java.util.Date mapped to wrong rdbms type
Is ReferentialJDOStateManager not used in DataNucleus 4.x?
DataNucleus JDO primary key with enum
How to create a Datanucleus JPA 2.x query with CriteriaQuery that is based on values from an embedded map
How do I replace Hibernate with DataNucleus JPA in a JHipster project?
getting this error while enhancing using Datanucleus. any idea
Weird “com.vividsolutions.jts.geom.Geometry” ClassNotResolvedException exception
Does DataNucleus persist JodaTime's DateTime differently with a non-local timezone?
Bulk update with datanucleus errors out
Detailed and clear specification for datanucleus jdo extensions?
Unique constraint with DataNucleus discriminator based multitenancy
Datanucleus fetchgroup composite key
Is there a good step-by-step tutorial for using datanucleus and maven?

Categories

HOME
ckan
dronekit
liquibase
boxplot
jquery-plugins
multipartform-data
genexus
revit-api
promotions
annyang
coding-style
google-app-maker
angular-universal
core-data
dynamics-crm-2011
comma
box2d
filehelpers
cucumberjs
jquery-easyui
airbnb
datazen-server
grunt-contrib-uglify
knapsack-problem
gulp-jshint
dynamics-ax-2012-r3
ibm-bpm
android-scrollview
sdl-2
respect-validation
stdin
paperclip
head
codepen
android-doze-and-standby
mef
line-endings
spring-data-commons
hierarchical-clustering
multivalue
kendo-scheduler
critical-section
petapoco
printer-control-language
bipartite
trusted-computing
toggleclass
papyrus
netlink
airwatch
jersey-test-framework
markerspiderfier
ios8-share-extension
traminer
tess4j
joomla3.3
tooltwist
vensim
copy-on-write
bungeecord
attiny
douglas-peucker
optimistic-locking
nsurlrequest
redmine-plugins
xpand
telerik-appbuilder
reactjs-native
connections
html5-filesystem
data-layers
kuka-krl
violation
angularjs-select2
playing-cards
proj4
http-compression
exi
simplemembership
facebook-winjs-sdk
cherokee
log-shipping
windows-xp-embedded
designated-initializer
n2
p4.net
coderush-xpress
data-formats
expander
asp.net-1.1

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App