# How to lazy load an attribute without using ByteCode Enhancement?

**URL:** https://discourse.hibernate.org/t/how-to-lazy-load-an-attribute-without-using-bytecode-enhancement/9084
**Category:** Hibernate ORM
**Created:** [February 23, 2024, 11:47am UTC](https://discourse.hibernate.org/t/how-to-lazy-load-an-attribute-without-using-bytecode-enhancement/9084 "2024-02-23T11:47:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![akshitagarwal](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/akshitagarwal/32/2266_2.png) [@akshitagarwal](https://discourse.hibernate.org/u/akshitagarwal)
#### Post date: [February 23, 2024, 11:47am UTC](https://discourse.hibernate.org/t/how-to-lazy-load-an-attribute-without-using-bytecode-enhancement/9084/1 "2024-02-23T11:47:31Z")

</div>

What is the right approach to lazy load an attribute without using byte-code enhancement?

---

<div class="post-metadata">

### Author: ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)
#### Post date: [February 26, 2024, 9:15am UTC](https://discourse.hibernate.org/t/how-to-lazy-load-an-attribute-without-using-bytecode-enhancement/9084/2 "2024-02-26T09:15:26Z")

</div>

There is none. It’s simply not possible. The only things that can be lazy loaded without bytecode enhancement are associations and that works by creating proxies.

---

<div class="post-metadata">

### Author: ![akshitagarwal](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/akshitagarwal/32/2266_2.png) [@akshitagarwal](https://discourse.hibernate.org/u/akshitagarwal)
#### Post date: [February 29, 2024, 6:49am UTC](https://discourse.hibernate.org/t/how-to-lazy-load-an-attribute-without-using-bytecode-enhancement/9084/3 "2024-02-29T06:49:21Z")

</div>

@beikov Is it possible to enable byte-code enhancement for selective classes? Also, it is possible to enable byte-code enhancement at application run-time?

---

<div class="post-metadata">

### Author: ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)
#### Post date: [March 4, 2024, 9:13am UTC](https://discourse.hibernate.org/t/how-to-lazy-load-an-attribute-without-using-bytecode-enhancement/9084/4 "2024-03-04T09:13:06Z")

</div>

You could enhance just certain classes with the build time enhancement plugin by splitting your persistence model into different JARs/projects and applying the enhancer only on the JARs that you want to enhance, but if you want to use runtime enhancement, you can only enhance everything.  
You can read more about runtime enhancement in the [documentation](https://docs.jboss.org/hibernate/orm/6.4/userguide/html_single/Hibernate_User_Guide.html#tooling-enhancement-runtime).
