jpa

“ConcurrentModificationException” when updating my entities

≡放荡痞女 提交于 2020-12-26 12:13:48
问题 Problem Im using hibernate 5.4.11 core and when i try to update large amounts of entities i run into that issue right here. It looks like an hibernate internal exception. Update I tested it with hibernate 5.4.23, the same exception occured. I also updated my "mysql connector" to the latest version "8.0.22" and it didnt worked either, the same exception. Describtion This is how i update my entities, it runs in another thread, which should not be the problem here... its basically a own thread

Why does JPA OneToOne (even OneToMany) have its orphanRemoval default to false

此生再无相见时 提交于 2020-12-15 05:20:49
问题 Why does JPA OneToOne (or even OneToMany for that matter) have its orphanRemoval default to false . I mean, wouldn't it be better to force the remove operation to entities that have been removed from the relationship and to cascade the remove operation to those entities by default & have the user make the choice to not do it explicitly? Would the current behavior of the default being false not result in orphan entries (that might potentially become zombie records) that might lead to bloat of

Why does JPA OneToOne (even OneToMany) have its orphanRemoval default to false

我是研究僧i 提交于 2020-12-15 05:20:20
问题 Why does JPA OneToOne (or even OneToMany for that matter) have its orphanRemoval default to false . I mean, wouldn't it be better to force the remove operation to entities that have been removed from the relationship and to cascade the remove operation to those entities by default & have the user make the choice to not do it explicitly? Would the current behavior of the default being false not result in orphan entries (that might potentially become zombie records) that might lead to bloat of

org.eclipse.persistence.indirection.IndirectMap cannot be cast to org.eclipse.persistence.queries.FetchGroupTracker using EclipseLink

﹥>﹥吖頭↗ 提交于 2020-12-15 04:55:33
问题 I have the following design: One sports game has two scores (one per team) and each score has multiple player stats, one per jersey number. Both relationships are mapped as Map . This is just multi-level aggregation. Game entity: @Entity @Table(name = "\"Games\"") @NamedQuery(name = Game.FIND_ALL, query = "SELECT ga FROM Game ga") @NamedEntityGraph(name = Game.FETCH_SCORES, attributeNodes = {@NamedAttributeNode("scores")}) @NamedEntityGraph(name = Game.FETCH_SCORES_AND_PLAYER_STATS,

JPA: EntityGraph and map

拟墨画扇 提交于 2020-12-13 18:46:05
问题 I use EclipseLink 2.6.3 as JPA provider. I have two entities: @Entity public class ClassA{ @Id private String uuid; private String comment; @OneToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL,mappedBy = "classA",orphanRemoval = false) @MapKey(name="code") private Map<String,ClassB> texts; //+ getters and setters } @Entity public class ClassB { @Id private String uuid; private String code; private String name; @ManyToOne @JoinColumn(name = "comeColname") private ClassA classA; //

JPA: EntityGraph and map

痴心易碎 提交于 2020-12-13 18:44:01
问题 I use EclipseLink 2.6.3 as JPA provider. I have two entities: @Entity public class ClassA{ @Id private String uuid; private String comment; @OneToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL,mappedBy = "classA",orphanRemoval = false) @MapKey(name="code") private Map<String,ClassB> texts; //+ getters and setters } @Entity public class ClassB { @Id private String uuid; private String code; private String name; @ManyToOne @JoinColumn(name = "comeColname") private ClassA classA; //

Simple Bidirectional @OneToOne store null

半城伤御伤魂 提交于 2020-12-13 03:46:10
问题 I try to follow the @OneToOne bidrectional example from documetation but I always have a null reference in the PhoneDetails phone_id colum, and obtein a Phone with null details when do a get. I follow the documentation creating Phone and PhoneDetails Classes as is say. But because the documentation don't specify how to test and I need to develop an Spring Boot app, I create one to test and maybe, in any step of this I have the error. Here are my steps, and the code I update to github hoping

jpa criteria compare two strings in without considering spaces

僤鯓⒐⒋嵵緔 提交于 2020-12-12 11:34:24
问题 I think that it is a basic question, but I'm struggling to get an answer. The question is: using CriteriaBuilder and Predicate how can I compare strings without considering spaces in the middle. For example: "CH 525 kV AREIA 1077 PR" . There isn't a "replace" function in CriteriaBuilder library. cb.like(equipamento.get(EquipamentoBO_.txNomeLongo), "%" + dto.getTxNomeEquipamento().toUpperCase().replace(" ", "") + "%") Thanks 回答1: There is a function method which should do the trick for you if

jpa criteria compare two strings in without considering spaces

落花浮王杯 提交于 2020-12-12 11:31:22
问题 I think that it is a basic question, but I'm struggling to get an answer. The question is: using CriteriaBuilder and Predicate how can I compare strings without considering spaces in the middle. For example: "CH 525 kV AREIA 1077 PR" . There isn't a "replace" function in CriteriaBuilder library. cb.like(equipamento.get(EquipamentoBO_.txNomeLongo), "%" + dto.getTxNomeEquipamento().toUpperCase().replace(" ", "") + "%") Thanks 回答1: There is a function method which should do the trick for you if

JPA 2.0 disable session cache for unit tests

二次信任 提交于 2020-12-10 06:45:53
问题 I am writing unit test for my services e. g. : @Test @Rollback(value = true) public void testMethod() { // insert test data myService.Method(); // read/write from DB // asserts go here } While application running, a new transaction is created every time method A entered. But during the unit test execution - when test testMethod entered. So method A doesn't create new one. For proper testing I need to clear cache before every call to service inside test.I don't want to write Session.clear()