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
qlikview
pact
autohotkey
excel-formula
model-view-controller
url
magento-1.9.2.1
crm
salesforce-lightning
download
comments
meson-build
google-my-business-api
oms
openbsd
vichuploaderbundle
email-attachments
swift3.1
loader
caldav
monad-transformers
bootstrap-accordion
windowserror
oracle10g
adobe-captivate
proof-general
large-files
typeorm
kundera
spring-data-gemfire
xlib
andengine
fastadapter
openvms
dropdownbox
leaderboard
kofax
azure-storage-files
oracle-bpm-suite
client-server
scalamock
gem-fury
observer-pattern
delphi-xe
bzip2
g77
audio-fingerprinting
gige-sdk
scanf
stringbuilder
altova
vga
falcon
angular-i18n
nugetgallery
angular-promise
ruby-1.8.7
taverna
jain-sip
android-togglebutton
hexagonal-tiles
sparkcore
dcg
opennebula
jeet-grid
valdr-bean-validation
nfa
fiware-health
iphone-6
random-access
jsonmodel
information-hiding
clearcanvas
pytz
rpt
telerik-appbuilder
sendy
smartxls
sigma-grid-control
data-layers
flask-mongoengine
codio
svg-android
google-voice
8-puzzle
tlbimp
kademlia
azure-scheduler
windows-scheduler
simplemembership
correctness
esi
php-gettext
systrace
erlide
yii-cactiverecord
automapper-2
wdm
rjs
mismatch
sipdroid
mediastreamsource
newspeak
lts
pixel-bender
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