0

I have a question regarding load method of Hibernate. from the below code fragments, the first one throws ObjectNotFoundException where as the second one, simply returns a proxy. what is the difference between annotating @Id at field level and annotating at getter method() level

1)

class Test {

  @Id
  private long id;

}

2)

class Test {

  private long id;

  @Id
  public long getId() {
      return id;
  }

} 

Thank you all

regards sivakiran B

v.ladynev
  • 19,275
  • 8
  • 46
  • 67
user1061216
  • 83
  • 2
  • 7

0 Answers0