-
Notifications
You must be signed in to change notification settings - Fork 356
MappedCollection leads to ConverterNotFoundException
when upgrading to 3.2
#1684
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
Comments
Having different names of the id-columns works, but the same does not (such as the reported issue) |
Using normal spring-data-jdbc (without using default UUID and InsertUpdateRepository) generates the same error. @Repository
interface FooRepository : CrudRepository<Foo, UUID>
data class Foo(
@Id
val id: UUID? = null,
@MappedCollection(idColumn = "foo_id")
val eksternId: ExternalFooId = ExternalFooId(),
)
@Table("foo_external")
data class ExternalFooId(
@Id
val id: Long = 0,
) CREATE TABLE foo
(
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY
);
CREATE TABLE foo_external
(
id BIGSERIAL PRIMARY KEY,
foo_id UUID NOT NULL REFERENCES foo (id)
); |
Simplified test case added, in a fork of spring-data-relational: 56c4f62 |
Preliminary analysis: For some reason we access the value for |
Thanks for taking a look at it. Not setting the The thing i was wondering was if I actually was using the create table foo (
id UUID PRIMARY KEY,
external_id serial
...
)
create unique index on foo (external_id) |
There is no such thing as an |
Thanks! I meant |
I have the same issue, even with
When fetching a Is this something you are looking into, @schauder? Edit: Link to example code: https://github.com/blommish/spring-data-error-3.2.0/blob/spring-3.2.0-error-with-set/src/main/kotlin/no/blommish/BarRepository.kt |
Update - After some more testing:
This does NOT work:
|
The same issue happened to me after upgrading to Spring Data JDBC 3.2.1. |
…ects/spring-data-relational#1684 (comment) Dog fungerer ikke MappedCollection UTEN id.
When the child of a one-to-one relationship has an id, the value for that id gets read in the wrong way. We get the column name for that id use that to access the value in the RowDocument. This results in either no value at all being found or even worse, the value of a root entity with a property of same name being accessed. This is fixed by using the full AggregatePath instead of just the property for accessing that value. Closes #1684
When the child of a one-to-one relationship has an id, the value for that id gets read in the wrong way. We get the column name for that id use that to access the value in the RowDocument. This results in either no value at all being found or even worse, the value of a root entity with a property of same name being accessed. This is fixed by using the full AggregatePath instead of just the property for accessing that value. Closes #1684
When the child of a one-to-one relationship has an id, the value for that id gets read in the wrong way. We get the column name for that id use that to access the value in the RowDocument. This results in either no value at all being found or even worse, the value of a root entity with a property of same name being accessed. This is fixed by using the full AggregatePath instead of just the property for accessing that value. Closes #1684
ConverterNotFoundException
when upgrading to 3.2
When the child of a one-to-one relationship has an id, the value for that id gets read in the wrong way. We get the column name for that id use that to access the value in the RowDocument. This results in either no value at all being found or even worse, the value of a root entity with a property of same name being accessed. This is fixed by using the full AggregatePath instead of just the property for accessing that value. Closes #1684 Original pull request: #1775
Upgrading 3.1.4 -> 3.2.0
Using jdk temurin 17
When upgrading spring from 3.1.4 i get
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.util.UUID] to type [long]
Edit: Simplified test case: 56c4f62
Code: https://github.com/blommish/spring-data-error-3.2.0
Error: blommish/spring-data-error-3.2.0#1
Not really sure what the problem is, but it seems to be connected to that it is trying to map the value of the ExternalBarId (MappedCollection). The setup works fine not having a MappedCollection to another object.
Where the source is the barId (bar->id or bar_id)
Stacktrace
The text was updated successfully, but these errors were encountered: