         end
 
         with {:atomic, [record]} <- :mnesia.transaction(read) do
-          {:ok, load(record)}
+          {:ok, Mnesia.Repo.load(record)}
         else
           {:atomic, []} ->
             {:error, %Mnesia.RecordNotFoundError{id: id, table: table_name()}}

    |> struct.__struct__.get
  end

  def all(module) when is_atom(module) do
    fn ->
      :qlc.e(:mnesia.table module.table_name)

      end

      def load(record) do
        [mod |attrs] = Tuple.to_list(record)
        attrs = Enum.zip(mod.fields(), attrs)
        struct(mod, attrs)
      end

      def fields do
