Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-16300 (
https://hibernate.atlassian.net/browse/HHH-16300?atlOrigin=eyJpIjoiZTcwMG...
)
Re: PrePersist not executed with ManyToMany Jointable nested entity (
https://hibernate.atlassian.net/browse/HHH-16300?atlOrigin=eyJpIjoiZTcwMG...
)
This mapping makes absolutely no sense. Use two one-to-many mappings instead:
@Entity
@Table(name = "bar" )
public class Bar {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
private Long id;
@OneToMany(mappedBy = "bar" )
private List<FooBar> fooBars;
}
@Entity
@Table(name = "foo" )
public class Foo {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
private Long id;
@ManyToMany(mappedBy = "foo" , cascade = CascadeType.ALL)
private List<FooBar> fooBars;
}
@Entity
@Table(name = "foo_bar" )
public class FooBar {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
private Long id;
@ManyToOne(fetch = FetchType.LAZY)
private Bar bar;
@ManyToOne(fetch = FetchType.LAZY)
private Foo foo;
private String note;
@PrePersist
void prePersist(){
setNote( "XXXXX" );
}
}
(
https://hibernate.atlassian.net/browse/HHH-16300#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16300#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:eb3f1fe )