title: Insert multiple objects as instance variable in hibernate
body: <p>Please help me to understand why multiple Objects as instance variable insertion is not woking.</p>
  
  <p><strong>Professor.java</strong></p>
  
  <pre><code>@Entity
  public class Professor {
  @Id
  private long id;
  private String name;
  @Embedded
  private Courses daycourse;
  @Embedded
  @AttributeOverrides({
          @AttributeOverride(name="code",column=@Column(name="eve_code")),
          @AttributeOverride(name="desc",column=@Column(name="eve_desc"))})
  private Courses evecourse;
  // gettter and setters
  }
  </code></pre>
  
  <p><strong>Courses.java</strong></p>
  
  <pre><code>@Embeddable
  public class Courses {
  private String code;
  private String desc;
      // gettter and setters
  }
  </code></pre>
  
  <p><strong>Main.java</strong></p>
  
  <pre><code>         Professor prof = new Professor();
           prof.setId(1);
           prof.setName("leo");
  
           Courses evecourse = new Courses();
           evecourse.setCode("MCA");
           evecourse.setDesc("Desc");
  
           Courses daycourse = new Courses();
           daycourse.setCode("MSC");
           daycourse.setDesc("Desc");
  
  
           prof.setEvecourse(evecourse);
           prof.setDaycourse(daycourse);
  
  
  
           Session session = sessionFactory.openSession();
           session.beginTransaction();
           session.save(prof);            
           session.getTransaction().commit();
           session.close();
  </code></pre>
  
  <p>Output :</p>
  
  <pre><code>Hibernate: 
      create table Professor (
          id number(19,0) not null,
          code varchar2(255),
          desc varchar2(255),
          eve_code varchar2(255),
          eve_desc varchar2(255),
          name varchar2(255),
          primary key (id)
      )
  Hibernate: 
      insert 
      into
          Professor
          (code, desc, eve_code, eve_desc, name, id) 
      values
          (?, ?, ?, ?, ?, ?)
  Jul 05, 2014 12:08:51 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  WARN: SQL Error: 1747, SQLState: 42000
  Jul 05, 2014 12:08:51 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  ERROR: ORA-01747: invalid user.table.column, table.column, or column specification
  
  Jul 05, 2014 12:08:51 PM org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl release
  INFO: HHH000010: On release of batch it still contained JDBC statements
  Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute statement
      at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123)
      at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
  </code></pre>