forked from playframework/play1
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1566] Partial Fix TransientObjectException when orphanRemoval = true and removing and adding items [#1503] Partial fix Nested OneToMany relationships with orphanRemoval fails to commit [#1847] Partial fix Orphan removal not cascaded for @OnetoOne relationships
- Loading branch information
Showing
19 changed files
with
324 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file renamed
BIN
+79.4 KB
...rnate-commons-annotations-4.0.1.Final.jar → ...rnate-commons-annotations-4.0.2.Final.jar
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
---- | ||
Download Hibernate 4.2.15.Final source code, apply the patch, and build with gradle (tip use export GRADLE_OPTS=-Xmx1G -XX:MaxPermSize=512m) | ||
---- | ||
|
||
DRY RUN -> patch --dry-run -p1 -i hibernate-4.2.15-patch-play.patch | ||
APPLY -> patch -p1 -i hibernate-4.2.15-patch-play.patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
samples-and-tests/just-test-cases/app/models/zoo/Animal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package models.zoo; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
import javax.persistence.CascadeType; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.OneToMany; | ||
import javax.persistence.PreRemove; | ||
|
||
import play.db.jpa.JPA; | ||
import play.db.jpa.Model; | ||
|
||
@Entity | ||
public class Animal extends Model { | ||
|
||
@OneToMany(cascade = CascadeType.ALL, fetch=FetchType.EAGER , orphanRemoval = true) | ||
public List<Meal> meals; | ||
|
||
public Animal() { | ||
this.meals = new ArrayList<>(); | ||
meals.add(new Meal()); | ||
} | ||
|
||
@PreRemove | ||
protected void clean() { | ||
// hack to force removal of activity instances, otherwise deleting the | ||
// tiers instance fails because the join table still references | ||
// the activity instances that have not been correctly deleted => | ||
// Hibernate bug that seems to be fixed in Hibernate 4.2.7 and 4.3 | ||
// see https://hibernate.atlassian.net/browse/HHH-6484 | ||
final String cn = this.getClass().getSimpleName(); | ||
final String query = String.format("DELETE FROM %s_%s WHERE %s_id=%s", | ||
cn, Meal.class.getSimpleName(), cn, id); | ||
//JPA.em().createNativeQuery(query).executeUpdate(); // but this hack | ||
// causes a StackOverflowException in Play 1.3RC1 | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
samples-and-tests/just-test-cases/app/models/zoo/Meal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package models.zoo; | ||
|
||
import javax.persistence.Entity; | ||
|
||
import play.db.jpa.Model; | ||
|
||
@Entity | ||
public class Meal extends Model { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package models.zoo; | ||
|
||
import javax.persistence.CascadeType; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.OneToOne; | ||
|
||
import play.db.jpa.Model; | ||
|
||
@Entity | ||
public class Zoo extends Model { | ||
|
||
@OneToOne(cascade = CascadeType.ALL, fetch=FetchType.EAGER, orphanRemoval = true) | ||
public Animal lion; | ||
|
||
public Zoo() { | ||
} | ||
|
||
} |
Oops, something went wrong.