Skip to content
Advertisement

Tag: spring-data-jpa

Can’t register an custom Entity in Spring project

Hello I have custom entity which has fields like name, description, date ant others, I created EventRepository and EventServiceImpl. Also i have a model RegisterEvent. Event entity: EventRepository: EventServiceImpl: RegisterEvent Model But when i Try to register event in my Html : I get the following error: And in the browser shows: I don’t know whats happening in the error

Storing UUID as string in mysql using JPA

I came across a blog of using UUID with Hibernate and MySql. Now the problem is, whenever I take a look at the database the ID’s will be non-readable format (binary-16). How can I store UUID as a readable format like 7feb24af-fc38-44de-bc38-04defc3804fe instead of ¡7ôáßEN¹º}ÅÑs I was using this code And the result is ¡7ôáßEN¹º}ÅÑs. But I want it as

Page vs Slice when to use which?

I’ve read in Spring Jpa Data documentation about two different types of objects when you ‘page’ your dynamic queries made out of repositories. Page and Slice So, I’ve tried to find some articles or anything talking about main difference and different usages of both, how performance changes and how sorting affercts both type of queries. Does anyone has this type

How to use part of composite key in JPA repository methods?

I have a class with embedded Id Now in my repository I want to have a method to search only by secAccount, so how should I write findBy.. I tried findByAccountLinkKeySecAccount(String secAccount) but still no success. Answer I have rewritten your class and could add repository function as well. Here’s my implementation which you might consider taking a look at.

Query-by-example skip primitives?

Spring supports creating queries by examples of the object to look for. Like: Problem: if the @Entity has primitive fields, then their default value will actually be used for creating the query. The example above will result in: SELECT * from persons where lastname := ‘Smith’ and age := 0 In my example I have a database field where age

Advertisement