Replies: 2 comments 2 replies
-
The summary: The mapping for //@Id
@ManyToOne
@JoinColumns({
@JoinColumn(name = "TENANT_ID", referencedColumnName = "TENANT_ID", insertable = false, updatable = false),
@JoinColumn(name = "SOURCE_ID", referencedColumnName = "SOURCE_ID", insertable = false, updatable = false)
})
private AssetsObject assetsObject;
That is, the expectation when using Does that make sense? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks a lot for pointing out the incorrect usage for me. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, Rob
My posting in the google group seems to go unnoticed. So post it again here.
https://groups.google.com/g/ebean/c/imcUvp6XEHA
I use a federated primary key, create a federated foreign key, and associate many-to-one.
I failed when testing save. The error message is as follows:
set tenantId on [org.example.domain.AssetsObjectFieldId] arg[creator] type[org.example.domain.AssetsObjectFieldId] threw error
Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Long (java.lang.String and java.lang.Long are in module java.base of loader 'bootstrap')
It feels like ebean sets the value of the creator field to the tenantId field.
I tried to create a test case to reproduce the problem, but I found that this problem only occurs in my environment, so the test case I provided now reports another error, which I think may be a similar problem. Even if I add a value to the creator field, it will not be saved successfully, and when I save the object, even if the value of tenantId is set, an exception that tenantId is not set will be thrown (because I have constraints on tenantId).
test case I provided:
sql definition:
java bean definition:
test case code to reproduce:
the error output is as follows:
a repository that can run the issue:
https://github.com/lakxtxue/ebean-tests
Beta Was this translation helpful? Give feedback.
All reactions