spring-data-jpa

Find entity by exact matching in collection

牧云@^-^@ 提交于 2021-01-27 05:01:08
问题 I have entity like this: @Getter @Setter @Entity public class Conversation extends AbstractEntity{ @ElementCollection @Column(name = "user_id", nullable = false) @CollectionTable(name = "conversation_user", joinColumns = @JoinColumn(name = "conversation_id", nullable = false)) private List<String> usersIds; } Is possible to find conversation entity by spring's repository by exact matching of user ids? For instance I have these entities: id | user_ids ------------------------------------------

How to find all revisions for an entity using spring data envers?

血红的双手。 提交于 2021-01-27 01:47:19
问题 I am using spring-data-envers in my spring boot application. I can successfully log the audits on my entities. Now, I need to show audited data to the user in UI. Like there will be search form where user can select duration and entity for which he wants to see audit logs. RevisionRepository provided by string-data-envers has only three methods as follows. @NoRepositoryBean public interface RevisionRepository<T, ID extends Serializable, N extends Number & Comparable<N>> { /** * Returns the

How to find all revisions for an entity using spring data envers?

半世苍凉 提交于 2021-01-27 01:42:08
问题 I am using spring-data-envers in my spring boot application. I can successfully log the audits on my entities. Now, I need to show audited data to the user in UI. Like there will be search form where user can select duration and entity for which he wants to see audit logs. RevisionRepository provided by string-data-envers has only three methods as follows. @NoRepositoryBean public interface RevisionRepository<T, ID extends Serializable, N extends Number & Comparable<N>> { /** * Returns the

Hibernate LAZY loading and spring's UserDetails

北战南征 提交于 2021-01-25 08:06:08
问题 I have a stateless REST backend. So no HTML views. Just JSON and REST endpoints. Authentication is done with Json Web Tokens. The client sends a JWT in each request. My backend takes the user's email from the subject claim in this JWT. Then it loads the UserModel from the database in class LiquidoUserDetailsService implements UserDetailsService { ...} Each user is part of a team. But the Team is a big entity with a lot of information in it. So teams are only loaded lazily, when necessary:

Hibernate LAZY loading and spring's UserDetails

蹲街弑〆低调 提交于 2021-01-25 08:05:00
问题 I have a stateless REST backend. So no HTML views. Just JSON and REST endpoints. Authentication is done with Json Web Tokens. The client sends a JWT in each request. My backend takes the user's email from the subject claim in this JWT. Then it loads the UserModel from the database in class LiquidoUserDetailsService implements UserDetailsService { ...} Each user is part of a team. But the Team is a big entity with a lot of information in it. So teams are only loaded lazily, when necessary:

How to persist data to a MySql database from a 32k row Excel using JPA Pagination?

徘徊边缘 提交于 2021-01-24 09:45:10
问题 I have a large Excel file, with 32k rows, and a Java-Spring code that persist the Excel data to mySQL database. My code works for about 6k row's, but not for the entire Excel due to JPA limitation. I read that it can be done with JPA Pagination but all so far I found only info that collect data from DB (already persisted with data) and render to a UI. The Excel file contain 32k medicines, and this rows will be persisted into DB. I have this Controller layer with the following method: public

How to persist data to a MySql database from a 32k row Excel using JPA Pagination?

人走茶凉 提交于 2021-01-24 09:44:07
问题 I have a large Excel file, with 32k rows, and a Java-Spring code that persist the Excel data to mySQL database. My code works for about 6k row's, but not for the entire Excel due to JPA limitation. I read that it can be done with JPA Pagination but all so far I found only info that collect data from DB (already persisted with data) and render to a UI. The Excel file contain 32k medicines, and this rows will be persisted into DB. I have this Controller layer with the following method: public

How to persist data to a MySql database from a 32k row Excel using JPA Pagination?

痴心易碎 提交于 2021-01-24 09:43:41
问题 I have a large Excel file, with 32k rows, and a Java-Spring code that persist the Excel data to mySQL database. My code works for about 6k row's, but not for the entire Excel due to JPA limitation. I read that it can be done with JPA Pagination but all so far I found only info that collect data from DB (already persisted with data) and render to a UI. The Excel file contain 32k medicines, and this rows will be persisted into DB. I have this Controller layer with the following method: public

Spring Data: JPA repository findAll() to return *Map instead of List?

与世无争的帅哥 提交于 2021-01-21 13:19:28
问题 I have a Spring Data JPA repository interface that looks something like this: @Repository public interface DBReportRepository extends JpaRepository<TransactionModel, Long> { List<TransactionModel> findAll(); List<TransactionModel> findByClientId(Long id); } Is there a workaround to make the same but for a Collection to be returned of type HashMap<K, V> ? I've looked through the Spring Data classes and couldn't find anything other than List<> return values. 回答1: I dont think you will find an

JPA Criteria api with oracle12c JSON_VALUE function

放肆的年华 提交于 2021-01-21 11:29:05
问题 I'm trying to crete Criteria API query with JSON_VALUE function() is Oracle12c: select * from orderswhere (JSON_VALUE(duty, '$.department') in ( ? , ? , ? ,? , ? , ? , ?)); MODEL: @Entity @Table(name = "orders") @EntityListeners(AuditingEntityListener.class) public class Trade implements Serializable { @Convert(converter = JpaConverterJson.class) private Map<String, Object> duty; ..... } private Specification<InvoicePurchase> reportFormToSpec(Map<String, Object> params) { return (root, query,