datanucleus


How to load entity with its 1 to 1 relation in DataNucleus, using native SQL query with JOINS


I have an entity
class LoanApplication{
private Account account;
//...
}
class Account{
private LoanApplication loanApplication;
}
I want to use the following native query
select * from account a left join loan_application la on a.id = la.account_id where a.id in (1,2,3,4,5);
And get a Set of Account objects with LoanApplication objects.
How to do it with DataNucleus?
JDOQL does not have "entity graph". Perhaps you mean "fetch plans", which is more flexible. Anyway, the query would be something like
SELECT FROM mydomain.Account WHERE :vals.contains(this.id)
and then define an input parameters "vals" as a List of ints. i.e Java syntax.
And set your fetch plan to load the loanApplication field, so add such as the following to the mapping for Account.
<fetch-group name="loanApps">
<field name="loanApplication"/>
</fetch-group>
and then call
q.getFetchPlan().addGroup("loanApps");
before executing the query.

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
javafx
optimization
primefaces
intellij-idea
ldap
window.open
reference
esxi
artifactory
css-selectors
atlassian-fisheye
schema
sequence
cdn
rethinkdb
genexus
jetbrains
chef-recipe
webseal
exchange-transport-agents
loss
greensock
ibatis
novacode-docx
draw2d
django-rest-auth
keystone
android-wifi
descriptor
combinations
rndis
javaagents
pushbullet
rvm
core-animation
boost-log
rtos
microstrategy
ilog
intersection
border-layout
azure-storage-files
redhat-brms
ui-grid
autodesk-data-management
firefox-developer-edition
grails-2.0
codepen
taleo
runner
g77
programming-pearls
bipartite
qt3d
firebase-job-dispatcher
optional-parameters
boost-range
avi
event-tracking
play-json
updating
page-flipping
textblob
dpkt
web-standards
accpac
famous-engine
oxygenxml
parallel-port
msdropdown
triplestore
enquire.js
raddatepicker
zend-db-table
kohana-orm
cocotron
junction-table
architectural-patterns
brew
database-restore
setcookie
boost.build
qt5.1
wpml
jquery-1.8
unordered-set
visual-leak-detector
code-organization
parallel-python
chars
mediastreamsource
database-agnostic
for-xml
large-data-volumes
pkcs#7
cstring
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