create an entity extended the MultiTenant traits, for example:
class Demo implements MultiTenant<Demo> {
Integer tenantId
String message
}
save the Entity with Tenants.withoutId()
Tenants.withoutId {
def demo = new Demo()
demo.tenantId = 1
demo.message = 'just a test'
demo.save()
}
Expected Behaviour
The demo should be persisted into mysql
Actual Behaviour
Below exception is thrown:
Caused by: java.lang.IllegalArgumentException: Cannot assign value [DEFAULT] to property [tenantId] of type [java.lang.Integer] of class [demo.Demo]. The value could not be converted to the appropriate type: Failed to convert from type [java.lang.String] to type [java.lang.Integer] for value 'DEFAULT'; nested exception is java.lang.NumberFormatException: For input string: "DEFAULT"
at org.grails.datastore.mapping.reflect.FieldEntityAccess.setProperty(FieldEntityAccess.java:95)
at org.grails.orm.hibernate.multitenancy.MultiTenantEventListener.onApplicationEvent(MultiTenantEventListener.java:74)
Environment Information
Operating System: Mac OS 10.13.2
GORM Version: 6.1.6
Grails Version (if using Grails): 3.3.1
JDK Version: jdk8
other information
The Tenants.withoutId() works for Demo.get(1), so I think this should be a bug.
Steps to Reproduce
Expected Behaviour
The demo should be persisted into mysql
Actual Behaviour
Below exception is thrown:
Environment Information
other information
The Tenants.withoutId() works for Demo.get(1), so I think this should be a bug.