0

I wonder if it is possible to use the entitymanager metamodel to scan over loaded entities to identify fields with certain properties during a test. For example I want to see if any fields are defined as strings with a "max length of 1" to report them as possible "Char" type columns.

        val model = em.metamodel
        model.entities.forEach { entity ->
            entity.attributes.filter { !it.isCollection }.filter { it.javaType.isAssignableFrom(String::class.java) }
                .forEach { attribute ->
                    attribute // <- TODO here be dragons
                }
        }"
Kai
  • 2,145
  • 1
  • 20
  • 35

0 Answers0