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
reactjs
ssms
indexing
teradata
salesforce
service
readdir
esxi
ms-access-2010
procmon
kendo-asp.net-mvc
meson-build
markdown
wavefront
webpack-dev-server
normals
http-status-codes
react-select
hql
openstack-horizon
css-float
aws-devicefarm
passbook
url-parameters
restructuredtext
turn.js
polybase
infinite-loop
concatenation
scripting-language
resx
csproj
drawrect
tikz
log4net-configuration
scene7
availability
bootcamp
dom4j
ansible-inventory
mapquest
word-wrap
area
armadillo
jslider
aspose.pdf
flume-ng
qt-quick
f#-fake
lucee
serialversionuid
openidm
jenkins-docker
intermediate-language
multi-select
wicketstuff
catalyst
user-profile
treelist
bbedit
cexception
yfiles
android-contentresolver
taverna
traminer
consul-template
autoscaling
tokudb
gcc-warning
veeam
cl.exe
crtdbg.h
apache-pivot
agent-based-modeling
javacompiler
indic
disparity-mapping
isl
facebook-java-api
nomachine
code-complete
friendly-id
myrrix
grape-api
infomaker
wpa
backbone-views
select2-rails
phone-state-listener
antixsslibrary
pdf-reader
socketasynceventargs
motorola-droid
code-organization
jqzoom
virtual-printer
parallel-python
service-layer
norton
nyromodal
browser-state
xslt-grouping
datadude
djangoappengine
zend-acl
hotfix
tracd

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