typelevel / typelevel/doobie

Could not find or construct Composite[com.SomeCaseClass] when adding any simple type to a case class with over 35 parameters.

Open
#678 9 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
2.2k
Forks
379
Avg merge
14m
Merged PRs (30d)
8

Description

I have a case class for mapping rows that contains 43 fields. When I remove the last few fields so the case class only has 35 the error below goes away. When I add a 36th field to the case class with the same simple type as the 35th (Int or Option[Int] for example) the following error surfaces.

Could not find or construct Composite[com.SomeCaseClass].
If com.SomeCaseClass is a simple type (or option thereof) that maps to a single column, you're probably missing a Meta instance. If com.SomeCaseClass is a product type (typically a case class, tuple, or HList) then probably one of its component types is missing a Composite instance. You can usually diagnose this by evaluating Composite[Foo] for each element Foo of the product type in question.

Do I need to create a custom mapping or Meta instance for case classes over 35 fields?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported Composite derivation failure with a case class containing 35 fields, then add a 36th Int or Option[Int] field. Trace the Composite entry point mentioned in the report and determine whether the behavior is a bug or an arity limitation. Done means the larger case class maps successfully or the required custom mapping is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.