title: MappingException trying to use POJO for domain object in Grails
body: <p>I have couple of POJOs:</p>
  
  <pre><code>public class FlightBase {
  
      public AirportBase getDeparture() {
          return departure;
      }
  
      public void setDeparture(AirportBase departure) {
          this.departure = departure;
      }
  
      public AirportBase getDestination() {
          return destination;
      }
  
      public void setDestination(AirportBase destination) {
          this.destination = destination;
      }
  
      public String getDetails() {
          return details;
      }
  
      public void setDetails(String details) {
          this.details = details;
      }
      String details = "";
      AirportBase departure;
      AirportBase destination;
  }
  
  public class AirportBase {
      String icaoIdentifier = "KSPG";
  
      public String getIcaoIdentifier() {
          return icaoIdentifier;
      }
  
      public void setIcaoIdentifier(String icaoIdentifier) {
          this.icaoIdentifier = icaoIdentifier;
      }
  
  }
  </code></pre>
  
  <p>... I'm trying to use these as domain classes in a grails app by extending them:</p>
  
  <pre><code>package flightloggrails
  
      import com.flightloglib.domain.AirportBase
      import com.flightloglib.domain.FlightBase
  
      class Flight extends FlightBase  {
  
          static hasOne = [departure:AirportBase, destination:AirportBase ]
  
          static mapping = {
  
              departure type: Airport
              destination type: Airport
          }
  
  
          static constraints = {
              details( blank:false,null:false, widget:'textarea')
          }
      }
  </code></pre>
  
  <p>and this domain class :</p>
  
  <pre><code>package flightloggrails
  
  import com.flightloglib.domain.AirportBase
  
  class Airport extends AirportBase {
  
      static constraints = {
      }
  }
  </code></pre>
  
  <p>... keep getting this trying to execute 'run-app' (preceded by 'clean') :</p>
  
  <pre><code> Error 2012-04-24 06:50:18,892 [pool-5-thread-1] ERROR context.GrailsContextLoader  - Error executing bootstraps: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: flightloggrails.Airport, at table: flight, for columns: [org.hibernate.mapping.Column(departure)]
  Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: flightloggrails.Airport, at table: flight, for columns: [org.hibernate.mapping.Column(departure)]
     Line | Method
  -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  
  Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: flightloggrails.Airport, at table: flight, for columns: [org.hibernate.mapping.Column(departure)]
  -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  
  Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: flightloggrails.Airport, at table: flight, for columns: [org.hibernate.mapping.Column(departure)]
  -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  
  Caused by MappingException: Could not determine type for: flightloggrails.Airport, at table: flight, for columns: [org.hibernate.mapping.Column(departure)]
  -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  </code></pre>