Skip to content

Commit 09613d4

Browse files
EntityNotFoundException in Hibernate - change in persistence unit (eugenp#11092)
* JPA Entities and the Serializable Interface * JPA Entities and the Serializable Interface - edit after review * JPA Entities and the Serializable Interface - formatting * JPA Entities and the Serializable Interface - indentation * EntityNotFoundException in Hibernate * EntityNotFoundException in Hibernate - fix persistence unit config to allow multiple test to run in conjunction.
1 parent a039129 commit 09613d4

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

  • persistence-modules/hibernate-jpa/src/main

persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitynotfoundexception/Item.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public class Item implements Serializable {
1515
private String name;
1616
@ManyToOne(fetch = FetchType.LAZY)
1717
@JoinColumn(name = "category_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
18-
@NotFound(action = NotFoundAction.IGNORE)
1918
private Category category;
2019

2120
public long getId() {

persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
<property name="hibernate.generate_statistics" value="false"/>
115115
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
116116
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
117-
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1"/>
117+
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:db2;DB_CLOSE_DELAY=-1"/>
118118
<property name="javax.persistence.jdbc.user" value="sa"/>
119119
<property name="javax.persistence.jdbc.password" value=""/>
120120
</properties>
@@ -132,7 +132,7 @@
132132
<property name="hibernate.generate_statistics" value="false"/>
133133
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
134134
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
135-
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1"/>
135+
<property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:db3;DB_CLOSE_DELAY=-1"/>
136136
<property name="javax.persistence.jdbc.user" value="sa"/>
137137
<property name="javax.persistence.jdbc.password" value=""/>
138138
</properties>

0 commit comments

Comments
 (0)