1

There is no association in the entity shown below.
Does hibernate use proxy object to retrieve the User object?
The question is little bit same as this one.
But what if there is no associations?

@Entity
@Table(name="user")
public class User {
    @Id
    @GeneratedValue
    private int id;
    private String name;

    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
2
  • 1
    Can't you just test? Commented Apr 12, 2016 at 8:58
  • I couldn't find a way to test it. Please help me. Commented Apr 12, 2016 at 9:23

1 Answer 1

1

Use this to test for proxy

boolean proxy = user instanceof HibernateProxy;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.