Questions tagged [spring-data-jdbc]

Spring Data JDBC is part of the Spring Data umbrella project which makes it easy to implement JDBC based repositories.

Spring Data JDBC Project page.

Github Repository.

Introduction into Spring Data JDBC or if you prefer video over text try this 10 minute video introduction.

The very important topic of Aggregates and its ramifications for Spring Data JDBC.

FAQ

324 questions
2
votes
3 answers

Im geting the error Parameter 0 of constructor required a single bean, but 2 were found but one of the beans "found" has been deleted by me

Im trying to set up a h2 database using jpa/jdbc, after creating an implemntation for a query interface using jpa as opposed to jdbc i am now getting the error: Parameter 0 of constructor in com.nsa.charitystarter.service.CharityQueries required a…
2
votes
1 answer

Spring Data JDBC: Conversion of compound domain types

After listening to a nice talk about Spring Data JDBC and Doamin-Driven Design by Jens Schauder (as an AFOL I love your examples;-) I experimented a bit but get stuck quite soon with my domain types. Of course I need to write custom JDBC converters,…
2
votes
1 answer

unable to get custom NamingStrategy working

my Spring application has to read from a table called MY_DOMAIN_OBJECT which belongs to MY_CUSTOM_SCHEMA schema, note that the same table is present in the default schema as well. I'm using spring-data-jdbc but I'm not able to read from the right…
vortex.alex
  • 1,105
  • 3
  • 11
  • 24
2
votes
1 answer

Is it possible to use BYTEA fields with Spring Data JDBC (not JPA)

I'm trying to read a row in a Postgresql table that has a BYTEA field, using Spring Data JDBC, and it's failing with a Couldn't find PersistentEntity for type byte! MappingException. The method is failing in…
Mark Wright
  • 705
  • 7
  • 20
2
votes
1 answer

spring data jdbc use @query comments, How to match the parameters registered for entity

@Modifying @Query(value = "update orders o set o.status =#{#order.status} ") Integer updateOrder(@Param("order") Order order); @Modifying @Query(value = "update orders o set o.status = #{#order.status}") Integer…
sope_li
  • 21
  • 1
2
votes
1 answer

@CreatedDate annotated field is not written on Insert, @LastModifiedDate is

I created the following Entity and test it using h2: @Getter public class Topic { @Id private long id; private final Title title; @CreatedDate private LocalDateTime createdAt; @LastModifiedDate private LocalDateTime…
Joshua
  • 2,932
  • 2
  • 24
  • 40
2
votes
2 answers

How to join fetch associated child relation

i have the following constellation: public final class ApplicationUser { private final @Id @Wither long applicationUserId; @NotNull @Size(min = 4, max = 20) private final String login; @NotNull @Email private final String eMail; @Wither private…
Thomas Lang
  • 1,285
  • 17
  • 35
2
votes
1 answer

Spring Data JDBC with MyBatis not finding custom query

I'm trying to use Spring Data JDBC with MyBatis. I'm interested in using the out-of-the-box CRUD methods that CrudRepository provides and in writing ADDITIONAL custom queries defined in MyBatis XML files. From reading the instructions from…
Tony Falabella
  • 335
  • 1
  • 6
  • 17
2
votes
0 answers

One to many relashionship in aggregated child gets mapped incorrectly when retrieving it from database with spring-data-jdbc

I have an aggregate that has a one to one relationship, and in the second level, the child entity has a one to many relationship (a List). Currently when the entity gets saved it does what is expected, and is saving it OK. But when I try to get the…
Max Ene
  • 21
  • 2
2
votes
1 answer

Spring jdbc repository many-to-many conjunction table column names

I can't find where to define custom column name for conjunction table in case of many-to-many relationship in spring-data-jdbc. I extended aggregate example from https://github.com/spring-projects/spring-data-examples in my fork:…
2
votes
1 answer

Insert in oracle with Spring data JDBC CrudRepository using manual PK (not autogenerated)

I'm getting the following error inserting in Oracle DB with Spring Data JDBC v1.0.4 (not JPA): Caused by: org.springframework.dao.DataRetrievalFailureException: The generated key is not of a supported numeric type. Unable to cast [oracle.sql.ROWID]…
Roberto
  • 8,586
  • 3
  • 42
  • 53
2
votes
3 answers

Spring Data JDBC: DataRetrievalFailureException : Unable to cast [oracle.sql.ROWID] to [java.lang.Number]

I am new to Spring Data JDBC, and I am struggling to create a simple Dto and get it persisted on the DB. I am using Spring-Boot 2.1.1.RELEASE and and Oracle 12 Database. UserDto @Table(value="USERS_T") public class UserDto extends PersistableDto { …
mpssantos
  • 931
  • 13
  • 30
2
votes
2 answers

Strange one-to-many behaviour with Spring Data JDBC

I'm happening to end up with something really weird in Spring Data JDBC (using Spring Boot 2.1 with necessary starters) aggregate handling. Let me explain that case (I'm using Lombok, the issue might be related, though)... This is an excerpt from my…
Thomas Escolan
  • 1,298
  • 1
  • 10
  • 28
2
votes
1 answer

Question about Spring Data JDBC + Hikari + Postgres JSONB

I'm trying to build an API using Spring Boot Data JDBC with Postgres. I have a simple pojo that I wish to write to a table: public final class Test { private final String id; private final String definition; } The table has 2 columns, a…
Joao Neto
  • 310
  • 3
  • 18
2
votes
2 answers

Spring Data Jdbc - map inner class to table column

Using Spring Data JDBC I would like for the Inner variable 'inner' to be mapped to a varchar column in the outer table rather than being mapped to its own table. Is this possible? public class Outer { @Id private String id; private Inner…
Brett Y
  • 7,171
  • 1
  • 28
  • 42