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
  • 18,125
  • 7
  • 41
  • 62
user1061216
  • 73
  • 2
  • 6

0 Answers0