title: no row with the given identifier exists hibernate
body: <p>Hi i am working on Entity Mapping by using @ManyToOne Annotation.</p>
  
  <p>below is my entities with manytoone association between them</p>
  
  <p>student.java</p>
  
  <pre><code>@Entity
  @Table(name = "student")
  public class student{
  
      @Id
      @Column(name = "UserID")
      private String userid;
  
      @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
      @JoinColumns({
         @JoinColumn(name = "userrole1", referencedColumnName = "VALUE"),
         @JoinColumn(name = "userrole2", referencedColumnName = "DESCRIPTION")
  
      })
      private studentdetails1 userrole1;
  
      @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
      @JoinColumns({
         @JoinColumn(name = "userrole1", referencedColumnName = "VALUE",insertable=false, updatable=false),
         @JoinColumn(name = "userrole2", referencedColumnName = "DESCRIPTION", insertable=false, updatable=false)
  
      })
      private studentdetails2 userrole2;
  
  //setters and getters 
  //constructor
  
  }
  </code></pre>
  
  <p>studentdetails1.java</p>
  
  <pre><code>@Data
  @Entity
  @Table(name = "student_details1")
  public class studentdetails1 {
  
      @Id
      @Column(name = "VALUE")
      private String value;
  
      @Id
      @Column(name = "DESCRIPTION")
      private String description;
  
     //setters and getters 
     //constructor
  }
  </code></pre>
  
  <p>studentdetails2.java</p>
  
  <pre><code>@Data
  @Entity
  @Table(name = "student_details2")
  public class studentdetails2 {
  
      @Id
      @Column(name = "VALUE")
      private String value;
  
      @Id
      @Column(name = "DESCRIPTION")
      private String description;
  
     //setters and getters 
     //constructor
  }
  </code></pre>
  
  <p>appmain.java</p>
  
  <pre><code>public static void main()
  {
  
  //session configuration
       StudentDetails1  sd1 = new StudentDetails1();
              sd1.setValue("abc");
              sd1.setDescription("abcdef");
          StudentDetails2  sd2 = new StudentDetails2();
              sd2.setValue("abcd");
              sd2.setDescription("abcdefd");
  
              Student student1 = new Student();
              student1.setUserid("1");
              student1.setUserrole1(sd1);
              student1.setUserrole2(sd2);
  
              Student student2 = new Student();
              student2.setUserid("2");
              student2.setUserrole1(sd1);
              student2.setUserrole2(sd2);
          session.save(student1 );
          session.save(student2 );
  
          Student con = (Student ) session.get(Student .class,
                          String.valueOf(1));
          System.out.println(con.getUserid());
      }
  </code></pre>
  
  <p>getting error for below line</p>
  
  <pre><code>student con = (student ) session.get(student .class,
                      String.valueOf(1));
  </code></pre>
  
  <p>I am using EAGER FETCH TYPE,when I save the data I am able save and retrieve the data using SESSION.GET but when I comment the session.save methods, even though there are values in the database for these tables I am getting below error  </p>
  
  <pre><code>org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.studentdetails2e#studentdetails2(value=1, description=null)]
  
  at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:447)
  at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:233)
  at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
  at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
  at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080)
  at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1028)
  at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:623)
  at org.hibernate.type.EntityType.resolve(EntityType.java:431)
  at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:140)
  at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:898)
  at org.hibernate.loader.Loader.doQuery(Loader.java:773)
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
  at org.hibernate.loader.Loader.loadEntity(Loader.java:1933)
  at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
  at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
  at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3270)
  at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
  at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
  at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
  at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
  at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
  at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080)
  at org.hibernate.impl.SessionImpl.get(SessionImpl.java:997)
  at org.hibernate.impl.SessionImpl.get(SessionImpl.java:990)
  at com.softsol.test.ActvDayRangeRlTest.AccountValid(ActvDayRangeRlTest.java:74)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  </code></pre>
  
  <p>I tried to solve this but it showing same error.</p>
  
  <p>please suggest me how to solve this</p>