Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kotlin-querybean-generator generated wrong kotlin code for "Map<String, Any>" #3503

Open
ouyangem opened this issue Oct 21, 2024 · 1 comment

Comments

@ouyangem
Copy link

ouyangem commented Oct 21, 2024

Environment

Java 11, Kotlin 1.7.22, Gradle 8.5
ebean 14.7.0 | 15.7.0, h2database :2.3.232

plugins {
  id("idea")
  kotlin ("jvm") version "1.7.22"
  kotlin ("kapt") version "1.7.22"
  id("io.ebean") version "15.7.0"
  id("com.github.johnrengelman.shadow") version "7.1.2"
  application
}
dependencies {
  implementation("com.h2database:h2:2.3.232")
  implementation("io.ebean:ebean-h2:15.7.0")
  testImplementation("io.ebean:ebean-test:15.7.0")
  kapt("io.ebean:kotlin-querybean-generator:15.7.0")
}

Expected behavior

Generate lateinit var params: PScalar<QDevice, Map<String,Any>>

Actual behavior

Path: build/generated/source/kaptKotlin/main/com/foo/bar/domain/query/QDevice.kt

package com.foo.bar.domain.query;

// Strange "import" text
import ?;
//...
import extends;
import java.lang.Object;
// Some things are omitted
  lateinit var params: PScalar<QDevice, Map<String,? extends Object>>

Steps to reproduce

package com.foo.bar.domain

import io.ebean.annotation.DbMap
import jakarta.persistence.*

@Entity
@Table(name = "devices")
class Device(@Column(length = 50, unique = true) val name: String) {
  @Id
  var id: Int = 0

  @DbMap(length = 800)
  var params: Map<String, Any> = mapOf()
}

Screenshot

20241022001255

@ouyangem
Copy link
Author

After change this

  @DbMap(length = 800)
  var params: Map<String, Any> = mapOf()

To this

  @DbJson(storage = DbJsonType.VARCHAR, length = 800)
  var params: Map<String, Any> = mapOf()

Everything works fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant