<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/clipper/mapping/associations/association.rb</filename>
    </added>
    <added>
      <filename>lib/clipper/mapping/associations/one_to_many.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -34,9 +34,9 @@ require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;mapping&quot;
 require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;mapping&quot; + &quot;field&quot;
 # require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;mappings&quot; + &quot;mapping&quot;
 # require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;mappings&quot; + &quot;relation&quot;
-# require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;mappings&quot; + &quot;associations&quot; + &quot;association&quot;
+ require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;mapping&quot; + &quot;associations&quot; + &quot;association&quot;
 # require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;mappings&quot; + &quot;associations&quot; + &quot;many_to_one&quot;
-# require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;mappings&quot; + &quot;associations&quot; + &quot;one_to_many&quot;
+ require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;mapping&quot; + &quot;associations&quot; + &quot;one_to_many&quot;
 # require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;mappings&quot; + &quot;associations&quot; + &quot;many_to_many&quot;
 
 require Pathname(__FILE__).dirname + &quot;clipper&quot; + &quot;validations&quot;</diff>
      <filename>lib/clipper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -36,6 +36,7 @@ module Clipper
 
       @signatures = java.util.LinkedHashSet.new
       @accessors = java.util.LinkedHashSet.new
+      @associations = java.util.LinkedHashSet.new
       @types = java.util.LinkedHashSet.new
     end
 
@@ -85,8 +86,22 @@ module Clipper
       keys.include?(field)
     end
 
+    def one_to_many(name, mapped_name, &amp;match_criteria)
+      add_association OneToMany.new(self, name, mapped_name, &amp;match_criteria)
+    end
+
     private
 
+    def add_association(association)
+      if @associations.include?(association)
+        raise DuplicateAssociationError.new(&quot;Association #{association} is already a member of Mapping #{name.inspect}&quot;)
+      else
+        @associations &lt;&lt; association
+        association.class.bind!(association, target)
+        association
+      end
+    end
+
     class UnmappedFieldError &lt; StandardError
     end
 </diff>
      <filename>lib/clipper/mapping.rb</filename>
    </modified>
    <modified>
      <diff>@@ -23,21 +23,24 @@ class Integration::MappingTest &lt; Test::Unit::TestCase
 
       accessor :id =&gt; Integer
     end
+    @child_class = Class.new do
+      include Clipper::Accessors
+
+      accessor :id =&gt; Integer
+      accessor :parent_id =&gt; Integer
+    end
 
     @table_name = &quot;users&quot;
+    @mapping = Clipper::Mapping.new(@repository, @mapped_class, @table_name)
   end
 
   def test_field_with_valid_arguments
-    mapping = Clipper::Mapping.new(@repository, @mapped_class, @table_name)
-
     assert_nothing_raised do
       mapping.field(:id, @id_type.new)
     end
   end
 
   def test_field_requires_proper_arguments
-    mapping = Clipper::Mapping.new(@repository, @mapped_class, @table_name)
-
     assert_raises(ArgumentError) do
       mapping.field(:undeclared_accessor, @id_type.new)
     end
@@ -52,7 +55,6 @@ class Integration::MappingTest &lt; Test::Unit::TestCase
   end
 
   def test_field_adds_signature_accessor_and_types
-    mapping = Clipper::Mapping.new(@repository, @mapped_class, @table_name)
     mapping.field(:id, @id_type.new)
 
     assert_equal(1, mapping.signatures.size)
@@ -61,7 +63,6 @@ class Integration::MappingTest &lt; Test::Unit::TestCase
   end
 
   def test_accessing_fields
-    mapping = Clipper::Mapping.new(@repository, @mapped_class, @table_name)
     assert_raise(Clipper::Mapping::UnmappedFieldError) do
       mapping[:id]
     end
@@ -70,14 +71,12 @@ class Integration::MappingTest &lt; Test::Unit::TestCase
   end
 
   def test_field_has_a_mapping
-    mapping = Clipper::Mapping.new(@repository, @mapped_class, @table_name)
     mapping.field(:id, @id_type.new)
 
     assert_not_nil(mapping[:id].mapping, mapping)
   end
 
   def test_key_with_proper_arguments
-    mapping = Clipper::Mapping.new(@repository, @mapped_class, @table_name)
     mapping.field(:id, @id_type.new)
 
     assert_nothing_raised do
@@ -86,7 +85,6 @@ class Integration::MappingTest &lt; Test::Unit::TestCase
   end
 
   def test_key_can_only_be_called_once
-    mapping = Clipper::Mapping.new(@repository, @mapped_class, @table_name)
     mapping.field(:id, @id_type.new)
     mapping.key(:id)
 
@@ -96,18 +94,34 @@ class Integration::MappingTest &lt; Test::Unit::TestCase
   end
 
   def test_key_requires_field_to_be_declared
-    mapping = Clipper::Mapping.new(@repository, @mapped_class, @table_name)
-
     assert_raises(Clipper::Mapping::UnmappedFieldError) do
       mapping.key(:id)
     end
   end
 
   def test_is_key
-    mapping = Clipper::Mapping.new(@repository, @mapped_class, @table_name)
     id = mapping.field(:id, @id_type.new)
     mapping.key(:id)
 
     assert(mapping.is_key?(id))
   end
+
+  def test_one_to_many
+    assert_nothing_raised do
+      mapping.one_to_many(:children, @child_class) do |parent, child|
+      end
+    end
+  end
+
+  def test_one_to_many_requires_block
+    assert_raise(ArgumentError) do
+      mapping.one_to_many(:children, @child_class)
+    end
+  end
+
+  private
+
+  def mapping
+    @mapping
+  end
 end
\ No newline at end of file</diff>
      <filename>tests/integration/mapping_test.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>burn/lib/clipper/mappings/associations/association.rb</filename>
    </removed>
    <removed>
      <filename>burn/lib/clipper/mappings/associations/one_to_many.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>65b8ce8d435d6e04fa182ade362beae3bfb4e7ef</id>
    </parent>
  </parents>
  <author>
    <name>Fabio Rehm</name>
    <email>fgrehm@gmail.com</email>
  </author>
  <url>http://github.com/wiecklabs/clipper/commit/7c8768c2ee03f71dc20319738134a0d0fd8f5378</url>
  <id>7c8768c2ee03f71dc20319738134a0d0fd8f5378</id>
  <committed-date>2009-09-22T16:43:57-07:00</committed-date>
  <authored-date>2009-09-22T16:43:57-07:00</authored-date>
  <message>Adding mapping support for one-to-many associations</message>
  <tree>58e17ee97b6df6d05e42991a8acae2f29b9ed4a5</tree>
  <committer>
    <name>Fabio Rehm</name>
    <email>fgrehm@gmail.com</email>
  </committer>
</commit>
