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

No converter found capable of converting from type [microsoft.sql.DateTimeOffset] to type [java.time.Instant] #1873

Closed
kozla13 opened this issue Sep 4, 2024 · 1 comment
Assignees
Labels
type: enhancement A general enhancement

Comments

@kozla13
Copy link

kozla13 commented Sep 4, 2024

i am getting this error

org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [microsoft.sql.DateTimeOffset] to type [java.time.Instant]
CREATE TABLE [user]
(
    id      BIGINT IDENTITY (1,1) NOT NULL PRIMARY KEY,
    created DATETIMEOFFSET(6) DEFAULT SYSDATETIMEOFFSET()
);

import java.time.Instant;

import org.springframework.data.annotation.Id;

import lombok.Data;

@Data
public class User {
	@Id
	private Long id;

	private Instant created = Instant.now();
}
dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
	compileOnly 'org.projectlombok:lombok'
	developmentOnly 'org.springframework.boot:spring-boot-docker-compose'
	runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
	testImplementation 'org.springframework.boot:spring-boot-testcontainers'
	testImplementation 'org.testcontainers:junit-jupiter'
	testImplementation 'org.testcontainers:mssqlserver'
}

is it a bug

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 4, 2024
@mp911de mp911de added type: enhancement A general enhancement status: waiting-for-triage An issue we've not yet triaged and removed status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement labels Sep 4, 2024
@mp911de
Copy link
Member

mp911de commented Sep 4, 2024

JdbcSqlServerDialect ships with a converter to java.time.OffsetDateTime. Feel free to submit a pull request for a converter that is also registered with JdbcSqlServerDialect.

@mp911de mp911de added the status: ideal-for-contribution An issue that a contributor can help us with label Sep 4, 2024
@schauder schauder linked a pull request Sep 12, 2024 that will close this issue
schauder added a commit that referenced this issue Sep 12, 2024
See #1873
Original pull request #1875
@mp911de mp911de added this to the 3.4 M1 (2024.1.0) milestone Sep 12, 2024
@mp911de mp911de removed the status: ideal-for-contribution An issue that a contributor can help us with label Sep 12, 2024
@github-staff github-staff deleted a comment from GenaroSalomone Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants