1

I have a data model class Account.In Account class I have one one property Contact(Custom class) and this is having one to one mapping.So I am using like this in Account class:

@OneToOne(mappedBy = "account", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
public Contact getContact() {
        return contact;
    }

After doing this contact property is not lazy loading.I have tried optional=false and @LazyToOne (LazyToOneOption.NO_PROXY).But no luck. Could you please help me?

Geek
  • 65
  • 2
  • 8
  • possible duplicate of [Making a OneToOne-relation lazy](http://stackoverflow.com/questions/1444227/making-a-onetoone-relation-lazy) – Andreas Jul 15 '14 at 11:54

1 Answers1

1

Lazy Loading with OneToOne behaves little differently.

This might help you out. Just follow the post.

Ankur Singhal
  • 23,626
  • 10
  • 70
  • 108