-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: One/ManyToOne. No proxy Lazy loading. nullable=true. Issue
PostPosted: Wed Dec 10, 2014 8:51 pm 
Newbie

Joined: Wed Dec 10, 2014 7:21 pm
Posts: 1
Hello,
Need some help.
Lazy loading for OneToOne and ManyToOne relationships works with no issues if a column is not nullable (nullable = false). In case of nullable column (nullable=true) Hibernate throws "org.hibernate.UnresolvableObjectException: No row with the given identifier exists:.." exception while it retrieves null from DB. So It seems that @NotFound(action = NotFoundAction.IGNORE) doesn't do what it supposed to.

Works with no issues:
Code:
    @OneToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "EMPID", referencedColumnName = "EMPLOYEETMSID")
    @LazyToOne(LazyToOneOption.NO_PROXY)
    @NotFound(action = NotFoundAction.IGNORE)
    public Employee getEmployeeSE() {
        return employeeSE;
    }

Throws exception when retrieve Null:
Code:
    @ManyToOne(fetch = FetchType.LAZY, optional = true)
    @JoinColumn(name = "MANAGER", nullable = true)
    @LazyToOne(LazyToOneOption.NO_PROXY)
    @NotFound(action = NotFoundAction.IGNORE)
    public EmployeeTms getManager() {
        return this.manager;
    }

    public void setManager(EmployeeTms manager) {
        this.manager = manager;
    }


How can I avoid "org.hibernate.UnresolvableObjectException: No row with the given identifier exists:.." exception?

--
Thanks,
Eugene


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.