6.10.2021

Using related JPA entities without loading them

In case you need a referenced object but don't want to load it from the database.

em.getReference(Account.class, accountId)

getReference allows you to get an instance from the EntityManager, whose state may be lazily fetched, but is not loaded from the database right away.

Thx to https://stackoverflow.com/questions/12828919/how-do-i-save-an-entity-with-foreign-key-without-loading-the-related-entity-in-j

Jan

Softwareentwickler

Zur Übersicht

Standort Hannover

newcubator GmbH
Bödekerstraße 22
30161 Hannover

Standort Dortmund

newcubator GmbH
Westenhellweg 85-89
44137 Dortmund