title: How can I store currency in ROOM DB?
body: <p>I have entity:</p>
  
  <pre><code>@Entity(tableName = "products")
  public class Product{
  
      @PrimaryKey(autoGenerate = true)
      private Long id;
  
      @ColumnInfo(name = "amount")
      private BigDecimal amount;
  </code></pre>
  
  <p>I need store it in Room DB. I Can not store <code>BigDecimal</code> and I create converter:</p>
  
  <pre><code>public static class Converters {
          @TypeConverter
          public BigDecimal fromString(String value) {
              return value == null ? null : new BigDecimal(value);
          }
  
          @TypeConverter
          public Double amountToString(BigDecimal bigDecimal) {
              if (bigDecimal == null) {
                  return null;
              } else {
                  return bigDecimal.doubleValue();
              }
          }
      }
  </code></pre>
  
  <p>and add to column:</p>
  
  <pre><code>@TypeConverters(Converters.class)
      @ColumnInfo(name = "amount")
      private BigDecimal amount;
  </code></pre>
  
  <p>Now I store currency in double column. And I want method for summ totalcurrency:</p>
  
  <pre><code>@Query("SELECT SUM(amount) FROM products")
  LiveData&lt;Double&gt; totalSum();
  </code></pre>
  
  <p>But I think it is bad way, because I can lose some values when converting. </p>
  
  <p>My question: How can I ctore currency in ROOM DB? and return method</p>
  
  <pre><code>LiveData&lt;BigDecimal&gt; totalSum();
  </code></pre>