title: How do I use and map an inner class as a column field variable in Spring Boot?
body: <p>I am getting an error that I narrowed down to it being one of the column types is too complex: <code>(List&lt;Foo&gt;)</code>. How can I properly use my inner class as a column type?</p>
  <p>Here is the relevant snippet of my model code:</p>
  <p><strong>Users.java</strong></p>
  <pre><code>@Entity
  @Table(name = &quot;users&quot;)
  public class User {
  
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private long id;
  
  @Column(name = &quot;name&quot;)
  private String name;
  
  @Column(name = &quot;password&quot;)
  private String password;
  
  @Column(name = &quot;todos&quot;)
  private List&lt;TodoItem&gt; todos = new ArrayList&lt;TodoItem&gt;();
  
  public static class TodoItem {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      protected long id;
      protected String todo;
      protected boolean completed;
  
      public TodoItem() {}
  
      public TodoItem(String todo, boolean completed) {
          // super();
          this.todo = todo;
          this.completed = completed;
      }
  }
  
  public User(String name, String password, List&lt;TodoItem&gt; todos) {
      super();
      this.name = name;
      this.password = password;
      this.todos = todos;
  }
  </code></pre>
  <p>And here is the relevant error output I'm getting:</p>
  <p><strong>Console Log</strong></p>
  <pre><code>2021-01-15 01:18:30.966 ERROR 1480 --- [           main] j.LocalContainerEntityManagerFactoryBean : 
  Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate 
  SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: 
  java.util.List, at table: users, for columns: [org.hibernate.mapping.Column(todos)]
  2021-01-15 01:18:30.967  WARN 1480 --- [           main] ConfigServletWebServerApplicationContext : 
  Exception encountered during context initialization - cancelling refresh attempt: 
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
  'entityManagerFactory' defined in class path resource 
  [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init 
  method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] 
  Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could 
  not determine type for: java.util.List, at table: users, for columns: 
  [org.hibernate.mapping.Column(todos)]
  Error starting ApplicationContext. To display the conditions report re-run your application with 
  'debug' enabled.
  2021-01-15 01:18:31.004 ERROR 1480 --- [           main] o.s.boot.SpringApplication               : 
  Application run failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
  'entityManagerFactory' defined in class path resource 
  [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init 
  method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] 
  Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could 
  not determine type for: java.util.List, at table: users, for columns: 
  [org.hibernate.mapping.Column(todos)]
  </code></pre>
  <p>I'm starting to think it might not be possible and I need to make the inner class as a separate table</p>