title: Struts 2 Hibernate
body: <p>I am learning Struts2 and Hibernate...</p>
  
  <p>I have an customer class with a geography code associated with each instance.  When I display on my JSP, I need to break down each character with a label.</p>
  
  <pre><code>    String geoCode = "1324567890";
  </code></pre>
  
  <p>needs to become</p>
  
  <pre><code>    List&lt;String&gt; geoCodeList = "[1][2][3]..."
  </code></pre>
  
  <p>so that I can use a subset in the JSP.</p>
  
  <p>What I tried to do was add another attribute to my Customer.java object.  I have the following:</p>
  
  <pre><code>private String geoCode;
  private List&lt;String&gt; geoCodeList;
  
  @Column(name = "GEO_CD")
  public String getGeoCd() {
      return geoCd;
  }
  
  public void setGeoCd(String geoCd) {
      this.geoCd = geoCd;
  
      geoCdList = new ArrayList&lt;String&gt;();
  
      System.out.println("geo length = " + geoCd.length());
      for (int i=0; i &lt; geoCd.length(); i++) {
          geoCdList.add(geoCd.substring(i,i+1));          
      }
  }
  </code></pre>
  
  <p>This all works fine but once I add a getter method for geoCdList I get an error.</p>
  
  <pre><code>public List&lt;String&gt; getGeoCdList() {
      return geoCdList;
  }
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>    Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine     type for: java.util.List, at table: Customer, for columns: [org.hibernate.mapping.Column(geoCdList)]
      Dec 03, 2013 10:21:26 PM org.apache.catalina.core.StandardWrapperValve invoke
      SEVERE: Servlet.service() for servlet [default] in context with path [/msps-web] threw exception  [Filter execution threw an exception] with root cause
      org.hibernate.MappingException: Could not determine type for: java.util.List, at table: Customer, for columns: [org.hibernate.mapping.Column(geoCdList)]
  at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:306)
  at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:290)
  at org.hibernate.mapping.Property.isValid(Property.java:243)
  at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:464)
  at org.hibernate.mapping.RootClass.validate(RootClass.java:235)
  at org.hibernate.cfg.Configuration.validate(Configuration.java:1362)
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1865)
  at com.att.msps.database.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
  at com.att.msps.database.util.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:8)
  at com.att.msps.customer.view.CustomerAction.&lt;init&gt;(CustomerAction.java:28)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
  at java.lang.Class.newInstance(Class.java:374)
  at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:131)
  at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:162)
  at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:151)
  at com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:121)
  at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:297)
  at com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:397)
  at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:194)
  at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
  at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
  at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
  at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:553)
  at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
  at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
  at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
  at java.lang.Thread.run(Thread.java:724)
  </code></pre>
  
  <p>My guess is that it thinks it's a column on the table but I'm not really sure.  Any help would be appreciated.</p>
  
  <p>Thanks!!!!!</p>