Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8379237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:07:26+00:00 2026-06-09T16:07:26+00:00

I am having trouble with the Play! framework’s mapping function. I have suspicion that

  • 0

I am having trouble with the Play! framework’s mapping function. I have suspicion that it may not be able to support the amount of parameters I am passing in as it worked when I limited to just one mapping, but did not find much in the documentation: http://www.playframework.org/documentation/api/2.0.2/scala/index.html#play.api.data.Form

Here is the form:

val paymentForm: Form[PaymentValues] = Form(
// Define a mapping that will handle User values
mapping(
  "message" -> text, 
  "x_card_num" -> text,
  "x_exp_date" -> text,
  "exp_year" -> text,
  "exp_month" -> text,
  "x_card_code" -> text,
  "x_first_name" -> text,
  "x_last_name" -> text,
  "x_address" -> text,
  "x_city" -> text,
  "x_state" -> text,
  "x_zip" -> text,
  "save_account" -> text,
  "product_array" -> text,
  "x_amount" -> text,
  "products_json" -> text,
  "auth_net_customer_profile_id" -> text,
  "auth_net_payment_profile_id" -> text,
  "customer_id" -> text,
  "saved_payments_object" -> text )(PaymentValues.apply)(PaymentValues.unapply))

Any suggestions on breaking up the mapping in some way? Thanks in advance.

This is the error:

! Internal server error, for request [GET /] ->

sbt.PlayExceptions$CompilationException: Compilation error [Overloaded method value [mapping] cannot be applied to  ((java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]), (java.lang.String, play.api.data.Mapping[String]))]
at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11$$anonfun$apply$12.apply(PlayReloader.scala:224) ~[na:na]
at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11$$anonfun$apply$12.apply(PlayReloader.scala:224) ~[na:na]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2]
at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11.apply(PlayReloader.scala:224) ~[na:na]
at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11.apply(PlayReloader.scala:221) ~[na:na]
at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2]

Here is PaymentValues:

package models
// definition of PaymentValues
case class PaymentValues(
    message: String,
    x_card_num: String,
    x_exp_date: String,
    exp_year: String,
    exp_month: String,
    x_card_code: String,
    x_first_name: String,
    x_last_name: String,
    x_address: String,
    x_city: String,
    x_state: String,
    x_zip: String,
    save_account: String,
    product_array: String,
    x_amount: String,
    products_json: String,
    auth_net_customer_profile_id: String,
    auth_net_payment_profile_id: String,
    customer_id: String,
    saved_payments_object: String)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:07:27+00:00Added an answer on June 9, 2026 at 4:07 pm

    Looking deeper and deeper in the data API, the limitation comes both from Scala and Play.

    Actually, internally, Play will use a case class ObjectMapping to represent a mapping and to define the data binding.
    This ObjectMapping case class will take the target’s apply and unapply methods, the domain object (for unapply) and all the 20 parameters as constructor arguments. Count: 23 arguments.

    Scala has a limit at 22 (see here) for such Product Abstract Types (tuples, functions, case classes, …).

    That’s why a mapping for 20 parameters is not provided by Play… (actually it stops at 18 as said in the great comments to this post)

    EDIT

    If you don’t believe me… try this ^^

    import play.api.data._ 
    import validation._
    import format._
    
    def mapping[R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20](a1: (String, Mapping[A1]), a2: (String, Mapping[A2]), a3: (String, Mapping[A3]), a4: (String, Mapping[A4]), a5: (String, Mapping[A5]), a6: (String, Mapping[A6]), a7: (String, Mapping[A7]), a8: (String, Mapping[A8]), a9: (String, Mapping[A9]), a10: (String, Mapping[A10]), a11: (String, Mapping[A11]), a12: (String, Mapping[A12]), a13: (String, Mapping[A13]), a14: (String, Mapping[A14]), a15: (String, Mapping[A15]), a16: (String, Mapping[A16]), a17: (String, Mapping[A17]), a18: (String, Mapping[A18]), a19: (String, Mapping[A19]), a20: (String, Mapping[A20]))(apply: Function18[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, R])(unapply: Function1[R, Option[(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]]): Mapping[R] = {
      ObjectMapping20(apply, unapply, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
    }
    
    
    case class ObjectMapping20[R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20](apply: Function20[A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, R], unapply: Function1[R, Option[(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20)]], f1: (String, Mapping[A1]), f2: (String, Mapping[A2]), f3: (String, Mapping[A3]), f4: (String, Mapping[A4]), f5: (String, Mapping[A5]), f6: (String, Mapping[A6]), f7: (String, Mapping[A7]), f8: (String, Mapping[A8]), f9: (String, Mapping[A9]), f10: (String, Mapping[A10]), f11: (String, Mapping[A11]), f12: (String, Mapping[A12]), f13: (String, Mapping[A13]), f14: (String, Mapping[A14]), f15: (String, Mapping[A15]), f16: (String, Mapping[A16]), f17: (String, Mapping[A17]), f18: (String, Mapping[A18]), f19: (String, Mapping[A19]), f20: (String, Mapping[A20]), val key: String = "", val constraints: Seq[Constraint[R]] = Nil) extends Mapping[R] with ObjectMapping {
    
      val field1 = f1._2.withPrefix(f1._1).withPrefix(key)
    
      val field2 = f2._2.withPrefix(f2._1).withPrefix(key)
    
      val field3 = f3._2.withPrefix(f3._1).withPrefix(key)
    
      val field4 = f4._2.withPrefix(f4._1).withPrefix(key)
    
      val field5 = f5._2.withPrefix(f5._1).withPrefix(key)
    
      val field6 = f6._2.withPrefix(f6._1).withPrefix(key)
    
      val field7 = f7._2.withPrefix(f7._1).withPrefix(key)
    
      val field8 = f8._2.withPrefix(f8._1).withPrefix(key)
    
      val field9 = f9._2.withPrefix(f9._1).withPrefix(key)
    
      val field10 = f10._2.withPrefix(f10._1).withPrefix(key)
    
      val field11 = f11._2.withPrefix(f11._1).withPrefix(key)
    
      val field12 = f12._2.withPrefix(f12._1).withPrefix(key)
    
      val field13 = f13._2.withPrefix(f13._1).withPrefix(key)
    
      val field14 = f14._2.withPrefix(f14._1).withPrefix(key)
    
      val field15 = f15._2.withPrefix(f15._1).withPrefix(key)
    
      val field16 = f16._2.withPrefix(f16._1).withPrefix(key)
    
      val field17 = f17._2.withPrefix(f17._1).withPrefix(key)
    
      val field18 = f18._2.withPrefix(f18._1).withPrefix(key)
    
      val field19 = f19._2.withPrefix(f19._1).withPrefix(key)
    
      val field20 = f20._2.withPrefix(f20._1).withPrefix(key)
    
      def bind(data: Map[String, String]): Either[Seq[FormError], R] = {
        merge(field1.bind(data), field2.bind(data), field3.bind(data), field4.bind(data), field5.bind(data), field6.bind(data), field7.bind(data), field8.bind(data), field9.bind(data), field10.bind(data), field11.bind(data), field12.bind(data), field13.bind(data), field14.bind(data), field15.bind(data), field16.bind(data), field17.bind(data), field18.bind(data), field19.bind(data), field20.bind(data)) match {
          case Left(errors) => Left(errors)
          case Right(values) => {
            applyConstraints(apply(
    
              values(0).asInstanceOf[A1],
              values(1).asInstanceOf[A2],
              values(2).asInstanceOf[A3],
              values(3).asInstanceOf[A4],
              values(4).asInstanceOf[A5],
              values(5).asInstanceOf[A6],
              values(6).asInstanceOf[A7],
              values(7).asInstanceOf[A8],
              values(8).asInstanceOf[A9],
              values(9).asInstanceOf[A10],
              values(10).asInstanceOf[A11],
              values(11).asInstanceOf[A12],
              values(12).asInstanceOf[A13],
              values(13).asInstanceOf[A14],
              values(14).asInstanceOf[A15],
              values(15).asInstanceOf[A16],
              values(16).asInstanceOf[A17],
              values(17).asInstanceOf[A18],
              values(18).asInstanceOf[A19],
              values(19).asInstanceOf[A20]))
          }
        }
      }
    
      def unbind(value: R): (Map[String, String], Seq[FormError]) = {
        unapply(value).map { fields =>
          val (v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) = fields
          val a1 = field1.unbind(v1)
          val a2 = field2.unbind(v2)
          val a3 = field3.unbind(v3)
          val a4 = field4.unbind(v4)
          val a5 = field5.unbind(v5)
          val a6 = field6.unbind(v6)
          val a7 = field7.unbind(v7)
          val a8 = field8.unbind(v8)
          val a9 = field9.unbind(v9)
          val a10 = field10.unbind(v10)
          val a11 = field11.unbind(v11)
          val a12 = field12.unbind(v12)
          val a13 = field13.unbind(v13)
          val a14 = field14.unbind(v14)
          val a15 = field15.unbind(v15)
          val a16 = field16.unbind(v16)
          val a17 = field17.unbind(v17)
          val a18 = field18.unbind(v18)
          val a19 = field19.unbind(v19)
          val a20 = field20.unbind(v20)
    
          (a1._1 ++ a2._1 ++ a3._1 ++ a4._1 ++ a5._1 ++ a6._1 ++ a7._1 ++ a8._1 ++ a9._1 ++ a10._1 ++ a11._1 ++ a12._1 ++ a13._1 ++ a14._1 ++ a15._1 ++ a16._1 ++ a17._1 ++ a18._1 ++ a19._1 ++ a20._1) ->
            (a1._2 ++ a2._2 ++ a3._2 ++ a4._2 ++ a5._2 ++ a6._2 ++ a7._2 ++ a8._2 ++ a9._2 ++ a10._2 ++ a11._2 ++ a12._2 ++ a13._2 ++ a14._2 ++ a15._2 ++ a16._2 ++ a17._2 ++ a18._2 ++ a19._2 ++ a20._2)
        }.getOrElse(Map.empty -> Seq(FormError(key, "unbind.failed")))
      }
    
      def withPrefix(prefix: String): ObjectMapping20[R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20] = addPrefix(prefix).map(newKey => this.copy(key = newKey)).getOrElse(this)
    
      def verifying(addConstraints: Constraint[R]*): ObjectMapping20[R, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20] = {
        this.copy(constraints = constraints ++ addConstraints.toSeq)
      }
    
      val mappings = Seq(this) ++ field1.mappings ++ field2.mappings ++ field3.mappings ++ field4.mappings ++ field5.mappings ++ field6.mappings ++ field7.mappings ++ field8.mappings ++ field9.mappings ++ field10.mappings ++ field11.mappings ++ field12.mappings ++ field13.mappings ++ field14.mappings ++ field15.mappings ++ field16.mappings ++ field17.mappings ++ field18.mappings ++ field19.mappings ++ field20.mappings
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble figuring out how to use soundfonts on android (that have a
I have a couple of basic Rails problems that I'm having trouble finding relevant
I'm having trouble getting C# and JavaScript/jQuery to play nice here. I have a
I'm having trouble with Iphone's mediaplayercontroller. I'm able to play the video once, with
I am building a project using the Play framework and I am having trouble
I'm new to Play Framework, and having trouble rendering a JSON object. public static
I'm having trouble getting IE to play nice with my regex. I'm trying to
I'm having some trouble getting my Core Data entities to play nice and order
I'm having a little trouble getting Jquery to play nice with cakephp and I'm
I'm having a little trouble (more like an annoyance, really) when using the Play

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.